
var userIdmessage = document.getElementById("userIdmessage");
var changevideomessagevideoid = document.getElementById("changevideomessagevideoid");
var shangcvideouserid = document.getElementById("shangcvideouserid");
if (userIdmessage.innerHTML !== "") {
    shangcvideouserid.value = userIdmessage.innerHTML

    /*判断是否有历史记录 */

    var historydiv = document.getElementsByClassName("historydiv");
    // console.log(historydiv)
    // console.log("111111111")
    var historytools = document.getElementById("historytools");
    if (historydiv.length == 0) {
        historytools.style.display = "none"
        var containRightBottomone = document.getElementsByClassName("containRightBottom")[0];
        containRightBottomone.innerHTML = "暂无内容"
    } else {
        historytools.style.display = "block"
    }
}



var myspcontain = document.getElementById("myspcontain");
var allpages = document.getElementsByClassName("allpages")[0];
var nowpage = document.getElementsByClassName("nowpage")[0];
var prompt = document.getElementsByClassName("prompt");
var containRightjfdh = document.getElementById("containRightjfdh");

var nologincontain = document.getElementById("nologincontain");
var textcontain = document.getElementsByClassName("textcontain");
if (userIdmessage.innerHTML == "") {
    for (let j = 0; j < textcontain.length; j++) {
        textcontain[j].style.display = "none"
    }
    nologincontain.style.display = "block"
} else {
    nologincontain.style.display = "none"
}

/*侧边栏不同标题的跳转页面 */
var text = document.getElementsByClassName("text");

for (let i = 0; i < text.length; i++) {
    textcontain[2].style.display = "block"
    text[i].onclick =function () {
        if(userIdmessage.innerHTML!==""){
            nologincontain.style.display = "none"
            /*点击谁谁变色！！！ */
            for (let k = 0; k < text.length; k++) {
                text[k].style.backgroundColor = "white"
            }
            text[i].style.backgroundColor = "#e2b977"


            for (let j = 0; j < textcontain.length; j++) {
                textcontain[j].style.display = "none"

            }
            containRightjfdh.style.display = "none"
            textcontain[i].style.display = "block"
        }else{
                 nologincontain.style.display = "block"
                for (let j = 0; j < textcontain.length; j++) {
                    textcontain[j].style.display = "none"
                }
               
        }


    }
}





var test = window.location.href;
var numberId = test.split('?')[1]
if(userIdmessage.innerHTML!==""){
    nologincontain.style.display = "none"
    if (numberId == 0) {
        /*通知 */
        for (let i = 0; i < text.length; i++) {
            for (let j = 0; j < textcontain.length; j++) {
                textcontain[j].style.display = "none"
            }
            containRightjfdh.style.display = "none"
            textcontain[1].style.display = "block"

            for (let t = 0; t < text.length; t++) {
                text[t].style.backgroundColor = "white"
            }
            text[1].style.backgroundColor = "#e2b977"
        }
    } else if (numberId == 1) {
        /*历史 */
        for (let i = 0; i < text.length; i++) {
            for (let j = 0; j < textcontain.length; j++) {
                textcontain[j].style.display = "none"
            }
            containRightjfdh.style.display = "none"
            textcontain[2].style.display = "block"
            for (let t = 0; t < text.length; t++) {
                text[t].style.backgroundColor = "white"
            }
            text[2].style.backgroundColor = "#e2b977"
        }

    } else if (numberId == 2) {
        /*创作 */
        for (let i = 0; i < text.length; i++) {
            for (let j = 0; j < textcontain.length; j++) {
                textcontain[j].style.display = "none"
            }
            containRightjfdh.style.display = "none"
            textcontain[0].style.display = "block"
            for (let t = 0; t < text.length; t++) {
                text[t].style.backgroundColor = "white"
            }
            text[0].style.backgroundColor = "#e2b977"
        }

    } else if (numberId == 3) {
        /*收藏 */
        for (let i = 0; i < text.length; i++) {
            for (let j = 0; j < textcontain.length; j++) {
                textcontain[j].style.display = "none"
            }
            containRightjfdh.style.display = "none"
            textcontain[3].style.display = "block"
            for (let t = 0; t < text.length; t++) {
                text[t].style.backgroundColor = "white"
            }
            text[3].style.backgroundColor = "#e2b977"
        }

    } else if (numberId == 4) {
        /*设置 */
        for (let i = 0; i < text.length; i++) {
            for (let j = 0; j < textcontain.length; j++) {
                textcontain[j].style.display = "none"
            }
            containRightjfdh.style.display = "none"
            textcontain[5].style.display = "block"
            for (let t = 0; t < text.length; t++) {
                text[t].style.backgroundColor = "white"
            }
            text[5].style.backgroundColor = "#e2b977"
        }

    } else {
        /*下载 */
        for (let i = 0; i < text.length; i++) {
            for (let j = 0; j < textcontain.length; j++) {
                textcontain[j].style.display = "none"
            }
            containRightjfdh.style.display = "none"
            textcontain[4].style.display = "block"
            for (let t = 0; t < text.length; t++) {
                text[t].style.backgroundColor = "white"
            }
            text[4].style.backgroundColor = "#e2b977"
        }
    }
}else{
    function hhh() {
        for (let j = 0; j < textcontain.length; j++) {
            textcontain[j].style.display = "none"
        }
        nologincontain.style.display = "block";
    }
    hhh()

    if (numberId == 0) {
        for (let t = 0; t < text.length; t++) {
            text[t].style.backgroundColor = "white"
        }
        text[1].style.backgroundColor = "#e2b977"
        // hhh()


    } else if (numberId == 1){
        for (let t = 0; t < text.length; t++) {
            text[t].style.backgroundColor = "white"
        }
        text[2].style.backgroundColor = "#e2b977"
        // hhh()

    } else if (numberId == 2) {
        for (let t = 0; t < text.length; t++) {
            text[t].style.backgroundColor = "white"
        }
        text[0].style.backgroundColor = "#e2b977"
        // hhh()

    } else if (numberId == 3) {
        for (let t = 0; t < text.length; t++) {
            text[t].style.backgroundColor = "white"
        }
        text[3].style.backgroundColor = "#e2b977"
        // hhh()

    } else if (numberId == 4) {
        for (let t = 0; t < text.length; t++) {
            text[t].style.backgroundColor = "white"
        }
        text[5].style.backgroundColor = "#e2b977"
        // hhh()

    }else{
        for (let t = 0; t < text.length; t++) {
            text[t].style.backgroundColor = "white"
        }
        text[4].style.backgroundColor = "#e2b977"
        // hhh()
    }



    /*嘿嘿嘿 */
}


/*点击隐藏的头像下拉栏进行页面进入！！ */
var toptext = document.getElementsByClassName("toptext");
for (let i = 0; i < toptext.length;i++){
    toptext[i].onclick = function(){
        headimgHide.style.display="none"
        if(i==0){
            for (let i = 0; i < text.length; i++) {
                for (let j = 0; j < textcontain.length; j++) {
                    textcontain[j].style.display = "none"
                }
                containRightjfdh.style.display = "none"
                textcontain[1].style.display = "block"
            }
            /*消息通知 */
        }else if(i==1){
            for (let i = 0; i < text.length; i++) {
                for (let j = 0; j < textcontain.length; j++) {
                    textcontain[j].style.display = "none"
                
            }
            containRightjfdh.style.display = "none"
            textcontain[2].style.display = "block"
        }
            /*历史记录 */
        }else if(i==2){
            for (let i = 0; i < text.length; i++) {
                for (let j = 0; j < textcontain.length; j++) {
                    textcontain[j].style.display = "none"
                
            }
            containRightjfdh.style.display = "none"
            textcontain[0].style.display = "block"
        }
            /*创作中心 */
        }else if(i==3){
            for (let i = 0; i < text.length; i++) {
                for (let j = 0; j < textcontain.length; j++) {
                    textcontain[j].style.display = "none"
               
            }
                containRightjfdh.style.display = "none"
            textcontain[3].style.display = "block"
        }
            /*收藏列表 */
        }else{
            /*设置中心 */
            for (let i = 0; i < text.length; i++) {
                for (let j = 0; j < textcontain.length; j++) {
                    textcontain[j].style.display = "none"
               
            }
                containRightjfdh.style.display = "none"
             textcontain[5].style.display = "block"
        }

        }



    }
}








/*判断是否是新用户 */
var ifnewuser = document.getElementById("ifnewuser");
if (userIdmessage.innerHTML !== "") {
    axios({
        url: '/judgeOfNewUser',
        method: 'post',
        params: {
            userId: userIdmessage.innerHTML,
        }
    })
        .then(function (data) {
         
            if (data.data.data.object == "1") {
                console.log("新用户")
                ifnewuser.innerHTML = data.data.data.object
            } else {
                console.log("老用户")
                ifnewuser.innerHTML = data.data.data.object
            }

        })
        .catch(function (error) {
            console.log(error)
        })
}


/*点击开通会员！！进入重置会员页面！！！！ */
var tovip = document.getElementById("tovip");
var cover = document.getElementById("cover");
var modal = document.getElementById("modal");
var closes = document.getElementById("closes");
tovip.onclick = function () {
    /*点击开通vip，请先判断是否进行了登录！！！ */
    if (userIdmessage.innerHTML == "") {
        modal.style.display = "block";
        cover.style.display = "block";
        /*组员 */
        // $('.prompt').show().delay(1000).fadeOut();
        // prompt[0].innerText = "尚未登录，请先登录";
    } else {
        cover.style.display = "block";   //显示遮罩层
        modal.style.display = "block";   //显示弹出层
    }

}

var vipnickname = document.getElementById("vipnickname");
if (userIdmessage.innerHTML == "") {
    vipnickname.innerHTML = "尚未登录"
}


var vipaccount = document.getElementById("vipaccount");
if (userIdmessage.innerHTML == "") {
    vipaccount.innerHTML = "去登录"
    vipaccount.style.fontSize = "0.8em"
}
vipaccount.onclick = function () {
    if (vipaccount.innerHTML == "去登录") {
        cover.style.display = "none";
        modal.style.display = "none";
        logincover.style.display = "block";
        loginmodal.style.display = "block";
    }
}

/*自定义账号登录 */
var selfaccountloginaccount = document.getElementById("selfaccountloginaccount");
var selfaccountloginpassword = document.getElementById("selfaccountloginpassword")
var selfaccountloginbtn = document.getElementById("selfaccountloginbtn")

selfaccountloginbtn.onclick = function () {
    hidesearchinput.style.display = "none";
    axios({
        url: '/toLogin',
        method: 'post',
        params: {
            account: selfaccountloginaccount.value,
            password: selfaccountloginpassword.value
        }
    })
        .then(function (data) {
           
            if (data.data.data.message == "登录成功") {
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = "登录成功";
                window.location.reload();
            } else {
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = data.data.data.message;
            }



        })
        .catch(function (error) {
            console.log(error)
        })
}














                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

if (userIdmessage.innerHTML == "") {
} else {


    /*判断当天是否签到 */
    axios({
        url: '/judgeSignIn',
        method: 'get',
        params: {
            userId: userIdmessage.innerHTML,
        }
    })
        .then(function (data) {
            console.log(data.data.data.object)
            if (data.data.data.object == "1") {
                qd.innerHTML = "已签到";
                document.getElementById("qd").style.cursor = " not-allowed";
                qd.style.color = "black";
                jf.style.display = "none";
            } else {
                /*还未进行签到 */
            }
        })
        .catch(function (error) {
            console.log(error)
            console.log('判断当天是否签到失败')
        })


    axios({
        url: '/findUserPoint',
        method: 'get',
        params: {
            userId: userIdmessage.innerHTML,
        }
    })
        .then(function (data) {
            console.log(data.data.data)
            var nowjf = data.data.data.object
            alljf.innerHTML = data.data.data.object

        })
        .catch(function (error) {
            console.log(error)
            console.log('查询个人积分失败')
        })



    axios({
        url: '/judgeUserVipTime',
        method: 'post',
        params: {
            userId: userIdmessage.innerHTML,
        }
    })
        .then(function (data) {
            console.log(data)
            console.log("11111111111111111111111111hahahahhahahahhahahahahahhahhaha")
            console.log(data.data.data.object)
            var viptime = document.getElementById("viptime");
            // alert(data.data.data.object)
            // if (data.data.data.object == "您未充值会员哦") {
            //     // wordone.innerHTML="";
            //     wordone.innerHTML = "您未充值会员哦"
            //     wordone.style.display="block"
            //     wordtwo.innerHTML = "";
            // } else if (data.data.data.object == "您的会员到期咯"){
            //     // wordone.innerHTML = "";
            //     wordone.innerHTML = "您的会员到期咯"
            //     wordone.style.display = "block"
            //     wordtwo.innerHTML = "";
            // }else{
            //     viptime.innerHTML = data.data.data.object
            //     wordtwo.innerHTML = "";
            //     wordone.style.display = "block"
            // }

            

        })
        .catch(function (error) {
            console.log(error)
            console.log('判断是否充值vip以及vip时间操作失败')
        })

}






var userpasswordmessage = document.getElementById("userpasswordmessage");
var userexpmessage = document.getElementById("userexpmessage");






/*登录之后 */
var account = document.getElementById("account");
var viptype = document.getElementById("viptype");
var topname = document.getElementById("topname");


if (userIdmessage.innerHTML !== "") {
    /*登录成功之后进行遍历个人信息 */
    axios({
        url: '/findUserById',
        method: 'get',
        params: {
            userId: userIdmessage.innerHTML,
        }
    })
        .then(function (data) {
            console.log(data.data.data.object)
            console.log("获取用户个人信息成功")

            /*头像的遍历 */
                navchangeimg.src = data.data.data.object.src
                topheadimg.src = data.data.data.object.src
                mymessageheadimg.src = data.data.data.object.src
                vipviewheadimg.src = data.data.data.object.src

            /*用户昵称的遍历 */
            console.log(data.data.data.object.nickname.length)
            var vipnickname = document.getElementById("vipnickname");
            var iflogin = document.getElementById("iflogin")
            if (data.data.data.object.nickname.length > 5) {
                var lastnickname = data.data.data.object.nickname.replace(/^\s*|\s*$/g, "").substring(0, 5) + "...";
                vipnickname.innerHTML = lastnickname
                topname.innerHTML = data.data.data.object.nickname
                leftnickname.innerHTML = lastnickname
                console.log(leftnickname.innerHTML)
                iflogin.innerHTML = lastnickname
                var nowname = document.getElementById("nowname")
                nowname.value = data.data.data.object.nickname

            } else {
                vipnickname.innerHTML = data.data.data.object.nickname
                topname.innerHTML = data.data.data.object.nickname
                leftnickname.innerHTML = data.data.data.object.nickname
                console.log(leftnickname.innerHTML)
                iflogin.innerHTML = data.data.data.object.nickname
                var nowname = document.getElementById("nowname")
                nowname.value = data.data.data.object.nickname
            }


            

            /*性别 */
            var nowsex = document.getElementById("nowsex").querySelector("input")
            nowsex.value = data.data.data.object.sex

            /*是否是视频号 */
            // videoNumber   0不是视频号   1是视频号
            var ifsphuser = document.getElementById("ifsphuser");
            ifsphuser.innerHTML = data.data.data.object.videoNumber;
            if (ifsphuser.innerHTML=="0"){
                console.log("不是视频号")
            }else{
                console.log("是视频号")
            }




            /*性别的遍历 */
            nowsex.value = data.data.data.object.sex
            /*关注与粉丝总数的遍历 */
            /*简介的遍历 */
            nowjj.value = data.data.data.object.introduction
            /*vip等级以及vip天数的遍历 */
         
            // viptype.innerHTML = data.data.data.object.vip;

            var getemail = document.getElementById("getemail");
            /*邮箱的遍历 */
            var ifbindemail = document.getElementById("ifbindemail");/*是否绑定邮箱 */
            if (data.data.data.object.email == "") {
                ifbindemail.innerHTML = "尚未绑定邮箱"
                getemail.innerHTML = "绑定邮箱"
            } else {
                ifbindemail.innerHTML = data.data.data.object.email
                getemail.innerHTML = "更改邮箱"
            }
            var loginpasswordinput = document.getElementById("loginpasswordinput");/*用户密码的遍历 */
            loginpasswordinput.innerHTML = "**********"


            /*账号与邮箱的遍历！！！！ */
            // var vipaccount = document.getElementById("vipaccount");
            // console.log(data.data.data.object.account);
            // if (data.data.data.object.account==""){
            //     vipaccount.innerHTML = "邮箱注册无账号"
            //     vipaccount.style.fontSize = "0.8em"
            // }else{
                // vipaccount.innerHTML = data.data.data.object.account
                // vipaccount.style.fontSize = "0.8em"
            // }


         



/*手镯 */
if(userIdmessage.innerHTML!==""){
            var admin = document.getElementById("admin");

            admin.onclick = function(){
                localStorage.setItem("userId", `${userIdmessage.innerHTML}`)
                 window.location.href="/admin"
            }


            /*判断是否是会员 */
            var viptype = document.getElementById("viptype")
            var tovip = document.getElementById("tovip");
            var novipimg = document.getElementById("novipimg");
            var havevipimg = document.getElementById("havevipimg");
            var wordone = document.getElementById("wordone");
            var wordtwo = document.getElementById("wordtwo");
            var szviptype = document.getElementById("szviptype");
            var nowvip = document.getElementById("nowvip");
                var hidebutton = document.getElementById("hidebutton");
                if (viptype.innerHTML == "0") {
                    console.log("普通用户")
                    hidebutton.innerHTML = "开通VIP"
                    tovip.innerHTML = "开通会员"
                    novipimg.style.display = "block";
                    havevipimg.style.display = "none";
                    wordtwo.style.display = "block"
                    wordone.style.display = "none"
                    szviptype.innerHTML = "您尚未开通任何会员"
                    nowvip.innerHTML = "立即开通vip"
                } else if (viptype.innerHTML == "1") {
                    console.log("vip用户")
                    tovip.innerHTML = "续费会员"
                    hidebutton.innerHTML = "续费VIP"
                    novipimg.style.display = "none";
                    havevipimg.style.display = "block";
                    wordone.style.display = "block"
                    wordtwo.style.display = "none"
                    szviptype.innerHTML = "您已开通黄金vip"
                    szviptype.style.color = "#e3b54c"
                    nowvip.innerHTML = "立即续费vip"
                }else{
                    /*里售价 */
                    if (wordone.innerHTML !== "您未充值会员哦" ||"您的会员到期咯"){
                        console.log("vip")
                        console.log("vip用户")
                        tovip.innerHTML = "续费会员"
                        hidebutton.innerHTML = "续费VIP"
                        novipimg.style.display = "none";
                        havevipimg.style.display = "block";
                        wordone.style.display = "block"
                        wordtwo.style.display = "none"
                        szviptype.innerHTML = "您已开通黄金vip"
                        szviptype.style.color = "#e3b54c"
                        nowvip.innerHTML = "立即续费vip"
                        admin.style.display = "block";
                    }else{
                        console.log("用户")
                        console.log("普通用户")
                        hidebutton.innerHTML = "开通VIP"
                        tovip.innerHTML = "开通会员"
                        novipimg.style.display = "block";
                        havevipimg.style.display = "none";
                        wordtwo.style.display = "block"
                        wordone.style.display = "none"
                        szviptype.innerHTML = "您尚未开通任何会员"
                        nowvip.innerHTML = "立即开通vip"
                        admin.style.display = "block";
                    }

                    
                }
}

            





        })
        .catch(function (error) {
            console.log(error)
            console.log('失败')
        })
    }




var toontherzh = document.getElementById("toontherzh");
var vipnickname = document.getElementById("vipnickname");
// if (userIdmessage.innerHTML == "") {
//     vipnickname.innerHTML = "尚未登录"
// } else {
//     vipnickname.innerHTML = "昵称未知"
// }

var vipaccount = document.getElementById("vipaccount");
if (userIdmessage.innerHTML == "") {
    vipaccount.innerHTML = "去登录"
    vipaccount.style.fontSize = "0.8em"
} 


var changeheadimguserid = document.getElementById("changeheadimguserid");
changeheadimguserid.value = userIdmessage.innerHTML



if (userIdmessage.innerHTML == "") {
    toontherzh.style.display = "none"
} else {
    toontherzh.style.display = "none"
}



/*查看粉丝列表是否互关 */
var closegz = document.getElementsByClassName("closegz");
var fsgogzbtn = document.getElementsByClassName("fsgogzbtn");
var ifwhether = document.getElementsByClassName("ifwhether")
for (let i = 0; i < ifwhether.length; i++) {
    if (ifwhether[i].innerHTML == "0") {
        fsgogzbtn[i].innerHTML = "回关"
    } else {
        fsgogzbtn[i].innerHTML = "已互关";
        closegz[i].style.display = "block"
    }
}
var gzclosegz = document.getElementsByClassName("gzclosegz");
/*查看关注列表是否互关 */
var gzifwhether = document.getElementsByClassName("gzifwhether");
console.log(gzifwhether)
var gogz = document.getElementsByClassName("gogz");
for (let i = 0; i < gzifwhether.length; i++) {
    console.log(gzifwhether[i].innerText)
    if (gzifwhether[i].innerHTML == "0") {
        gogz[i].innerHTML = "已关注"
        gzclosegz[i].style.display = "block"
    } else {
        gogz[i].innerHTML = "已互关"
        gzclosegz[i].style.display = "block"
    }
}








/*头像！！！！！ */
var navchangeimg = document.getElementById("navchangeimg");
var topheadimg = document.getElementById("topheadimg");
var vipviewheadimg = document.getElementById("vipviewheadimg");
/*进行登录 */
var nologintologin = document.getElementById("nologintologin");
nologintologin.onclick = function () {
    loginmodal.style.display = "block"
    headimgHide.style.display = "none"
}



var leftnickname = document.getElementById("leftnickname");
if (userIdmessage.innerHTML == "") {
    leftnickname.innerHTML = "尚未登录"
} else {
    /*获取粉丝总数 */
    axios({
        url: '/myFans',
        method: 'get',
        params: {
            userId: userIdmessage.innerHTML,
        }
    })
        .then(function (data) {
            console.log(data)
            console.log(data.data.data.data)
            console.log(data.data.data.record)
            fs.innerHTML = "粉丝:" + data.data.data.record
        })
        .catch(function (error) {
            console.log(error)
            console.log('获取粉丝总人数失败')
        })
    /*获取关注总人数 */
    axios({
        url: '/myAttention',
        method: 'get',
        params: {
            userId: userIdmessage.innerHTML,
        }
    })
        .then(function (data) {
            console.log(data.data.data.record)
            gz.innerHTML = "关注:" + data.data.data.record
        })
        .catch(function (error) {
            console.log(error)
            console.log('获取关注总人数失败')
        })


}













var containRightshangccontaininputs = document.getElementById("containRightshangccontain").querySelectorAll("input")
for (let i = 0; i < containRightshangccontaininputs.length; i++) {
    containRightshangccontaininputs[i].onfocus = function () {
        containRightshangccontaininputs[i].style.border = "1px solid #33BD6F"
    }
    containRightshangccontaininputs[i].onblur = function () {
        containRightshangccontaininputs[i].style.border = ""
    }
}


var containRightshangcdsjcontaininputs = document.getElementById("containRightshangcdsjcontain").querySelectorAll("input")
for (let i = 0; i < containRightshangcdsjcontaininputs.length; i++) {
    containRightshangcdsjcontaininputs[i].onfocus = function () {
        containRightshangcdsjcontaininputs[i].style.border = "1px solid #33BD6F"
    }
    containRightshangcdsjcontaininputs[i].onblur = function () {
        containRightshangcdsjcontaininputs[i].style.border = ""
    }
}







var hidesearchinput = document.getElementById("hidesearchinput");

/*第一个 历史记录 点击视频分类。变色，边框  内容变化 */
var containRightToplis = document.getElementsByClassName("fl")
var containRightBottom = document.getElementsByClassName("containRightBottom");
for (let i = 0; i < containRightToplis.length; i++) {
    containRightToplis[i].onclick = function () {
        for (let i = 0; i < containRightBottom.length; i++) {
            containRightBottom[i].style.display = "none"
        }
        containRightBottom[i].style.display="block"



        hidesearchinput.style.display = "none";
        for (let i = 0; i < containRightToplis.length; i++) {
            containRightToplis[i].style.color = "black";
            containRightToplis[i].style.borderBottom = "none";
        }
        containRightToplis[i].style.color = "#00cc36";
        containRightToplis[i].style.borderBottom = "2px solid #00cc36";
    }
}

/*收藏与订阅的标题变色 */
var containRightTopliss = document.getElementsByClassName("t")
var scleft = document.getElementById("scleft");
var scright = document.getElementById("scright");
for (let i = 0; i < containRightTopliss.length; i++) {
    containRightTopliss[i].onclick = function () {
        hidesearchinput.style.display = "none";
        if (i == 0) {
            scleft.style.display = "block";
            scright.style.display = "block";
        } else {
            /*订阅 */
            sccenter.style.display = "none";
            scleft.style.display = "none";
            scright.style.display = "none";
        }
        for (let i = 0; i < containRightTopliss.length; i++) {
            containRightTopliss[i].style.color = "black";
            containRightTopliss[i].style.borderBottom = "none";
        }
        containRightTopliss[i].style.color = "#00cc36";
        containRightTopliss[i].style.borderBottom = "2px solid #00cc36";
    }
}



/*创作中心的标题变色 */
var containRightTopli = document.getElementsByClassName("f")
var containRightshangccontain = document.getElementById("containRightshangccontain");
var mymp4contain = document.getElementById("mymp4contain");

var auditcontain = document.getElementById("auditcontain");


var changevideoimg = document.getElementById("changevideoimg")
function closechangevideoimgbtn() {
    changevideocover.style.display = "none";
    changevideoimg.style.display = "none";
}











for (let i = 0; i < containRightTopli.length; i++) {
    containRightTopli[i].onclick = function () {
        hidesearchinput.style.display = "none";
        var containRightshangcdsjcontain = document.getElementById("containRightshangcdsjcontain");
        /*变换内容 */
        if (i == 0) {
            containRightshangcdsjcontain.style.display = "none";
            containRightshangccontain.style.display = "block";
            mymp4contain.style.display = "none";
            auditcontain.style.displa
            y = "none";
        } else if (i == 1) {
            containRightshangcdsjcontain.style.display = "none";
            /*点击我的视频，然后进行遍历所有我的视频！！！！！ */
            containRightshangccontain.style.display = "none";
            mymp4contain.style.display = "block";
            auditcontain.style.display = "none";
            /*进行分页遍历我的视频内容！！！！！！ */
            function fenyemyvideo() {
                var pagenow = 1
                axios({
                    url: '/findAllVideoByUserId',
                    method: 'get',
                    params: {
                        userId: userIdmessage.innerHTML,
                        pageSize: 4,
                        pageNow: pagenow,
                    }
                })
                    .then(function (data) {

                        /*共多少页 */
                        allpages.innerHTML = data.data.data.data.pageTotal
                        nowpage.innerHTML = "1"

                        for (let i = 0; i < data.data.data.data.list.length; i++) {
                            myspcontain.innerHTML += ` 
                        <div class="mysp" >
                            <input class="checkbox" type="checkbox">
                                <video style="float: left; margin-left: 5%;margin-top: 1%" width="200" height="100" controls>
                                    <source src='${data.data.data.data.list[i].videoPath}'  type="video/mp4">
                                </video>
                                <div style="height: 100%;margin-top: 0.4%;float: right;border: none;outline: none;width: 65%;">
                                    <p>
                                        视频名称：${data.data.data.data.list[i].videoName}
                                    </p>
                                    <p>
                                        <span>创建人:${data.data.data.data.list[i].nickName}</span>
                                        <span style="margin-left: 10%;">创建日期:${data.data.data.data.list[i].releaseTime}</span>
                                    </p>
                                    <p class="changevideoid" style="display: none;">
                                    ${data.data.data.data.list[i].videoId}
                                    </p>
                                    <p>
                                        <button class="showvideomessage" style="color: #00cc36;">修改信息</button>
                                        <button class = "showvideoimg" style = "color: #4e6ef2;">修改图片</button>
                                        <button class="cancelvideobtn" style="color: #ff5c38;">删除</button>
                                    </p>
                                </div>
                            </div>
                    `
                        }


                        changevideo()









                    })
                    .catch(function (error) {
                        console.log(error)
                    })
            }
            fenyemyvideo()

            function changevideo() {
                /*修改视频属性 */
                var showvideomessage = document.getElementsByClassName("showvideomessage");
                var changevideocover = document.getElementById("changevideocover");
                var changevideomodal = document.getElementById("changevideomodal");
                var changevideoid = document.getElementsByClassName("changevideoid");
                console.log(changevideoid)

                for (let i = 0; i < changevideoid.length; i++) {
                    showvideomessage[i].onclick = function () {
                        changevideocover.style.display = "block";
                        changevideomodal.style.display = "block";
                        var videid = changevideoid[i].innerHTML.replace(/^\s*|\s*$/g, "")
                        console.log(videid)
                        axios({
                            url: "/findTVMsgByTVId",
                            method: "get",
                            params: {
                                tvId: videid,
                            }
                        })
                            .then(function (data) {
                                console.log(data.data.data.data)
                               
                                changevideomessagevideoid.innerHTML = videid
                                /*然后将信息遍历上去！！！！！！ */
                                var changespbt = document.getElementById("changespbt");/*标题 */
                                changespbt.value = data.data.data.data.videoName;
                                var changespjj = document.getElementById("changespjj");/*简介*/
                                changespjj.value = data.data.data.data.introduction;
                                var changesptype = document.getElementById("changesptype");/*视频类型 */
                                changesptype.value = data.data.data.data.videoType;
                                var changesparea = document.getElementById("changesparea");/*视频地区 */
                                changesparea.value = data.data.data.data.regionType;
                                var changespzf = document.getElementById("changespzf");/*视频资费 */
                                changespzf.value = data.data.data.data.whetherFree;
                                var changespyear = document.getElementById("changespyear");/*视频年份*/
                                changespyear.value = data.data.data.data.videoYear;
                                /*视频概述！！ */
                                var changespgs = document.getElementById("changespgs");
                                changespgs.value = data.data.data.data.videoBriefly;

                                /*视频封面 */
                                console.log(data.data.data.data.videoPhoto)
                                var videochangeimgfm = document.getElementsByClassName("videochangeimgfm")[0];
                                videochangeimgfm.src = `${data.data.data.data.videoPhoto}`
                                console.log(videochangeimgfm.src)
                            })
                            .catch(function (error) {
                                console.log(Error)
                            })



                    }
                }

                /*删除视频 */
                var cancelvideobtn = document.getElementsByClassName("cancelvideobtn");
                for (let i = 0; i < changevideoid.length; i++) {
                    cancelvideobtn[i].onclick = function () {
                        var videid = changevideoid[i].innerHTML.replace(/^\s*|\s*$/g, "")
                        axios({
                            url: '/deleteVideo',
                            method: 'delete',
                            params: {
                                videoId: videid,
                            }
                        })
                            .then(function (data) {
                                console.log(data)
                                $('.prompt').show().delay(1000).fadeOut();
                                prompt[0].innerText = "删除成功";
                                myspcontain.innerHTML=""
                                 fenyemyvideo()
                                 changevideo()

                                
                                // window.location.href="/myperson?2"

                            })
                            .catch(function (error) {
                                console.log(error)
                                console.log('删除单个视频失败')
                            })
                    }
                }

                /*修改视频图片！！！ */
                var showvideoimg = document.getElementsByClassName("showvideoimg");
                for (let i = 0; i < changevideoid.length; i++) {
                    showvideoimg[i].onclick = function () {
                        changevideocover.style.display = "block";
                        changevideoimg.style.display = "block";
                        var videid = changevideoid[i].innerHTML.replace(/^\s*|\s*$/g, "")
                        console.log(videid)
                        axios({
                            url: "/findTVMsgByTVId",
                            method: "get",
                            params: {
                                tvId: videid,
                            }
                        })
                            .then(function (data) {
                                console.log(data.data.data.data)
                                /*视频封面 */
                                // console.log(data.data.data.data.videoPhoto)
                                // var videochangeimgfm = document.getElementsByClassName("videochangeimgfm")[0];
                                // videochangeimgfm.src = `${data.data.data.data.videoPhoto}`
                                // console.log(videochangeimgfm.src)
                            })
                            .catch(function (error) {
                                console.log(Error)
                            })



                    }
                }



                /*创作中心副标题我的视频里面的批量删除！！！ */
                var cancelallvideo = document.getElementById("cancelallvideo");
                var cancelallsp = document.getElementById("cancelallsp");
                cancelallvideo.onclick = function () {
                    /*首先判断是否已经有选中的，没有的话就不弹出！！！！ */
                    cancelallsp.style.display = "block"
                    /*进行批量删除操作！！！！！ */
                    var inputs = document.querySelectorAll(".checkbox")
                    var oneidsarray = "";
                    /*获取到这个所有的input然后进行判断是否有选中的input */
                    for (let i = 0; i < inputs.length; i++) {
                        if (inputs[i].checked == true) {
                            
                            oneidsarray += changevideoid[i].innerHTML.replace(/^\s*|\s*$/g, "") + ",";
                        }
                    }


                    oneidsarrayy = oneidsarray.substring(0, oneidsarray.length - 1);
                    var noallcancelsp = document.getElementById("noallcancelsp");
                    noallcancelsp.onclick = function () {
                        // alert(oneidsarrayy)
                        var newoneidsarrayy = oneidsarrayy.toString()
                        axios({
                            url: '/deleteMoreMyVideos',
                            method: 'delete',
                            params: {
                                videoIds: newoneidsarrayy
                            }
                        })
                            .then(function (data) {
                                console.log(data)
                                console.log("批量删除成功")
                                cancelallsp.style.display = "none"
                                myspcontain.innerHTML = ""
                                fenyemyvideo()
                                changevideo()
                                // window.location.href = "/myperson?2"
                            })
                            .catch(function (error) {
                                console.log(error)
                                console.log('批量删除失败')
                            })
                    }
                }
            }
            changevideo()
            /*结束 */

            /*在我的视频里面通过关键字查询视频 */
            var mymp4search = document.getElementById("mymp4search");
            var searchmymp4contain = document.getElementById("searchmymp4contain");
            mymp4search.onclick = function () {
                /*判断是否有内容！！！ */
                if (searchmymp4contain.value == "") {
                    $('.prompt').show().delay(1000).fadeOut();
                    prompt[0].innerText = "请输入搜索内容进行搜索";
                } else {
                    axios({
                        url: '/findVideoByLikeKeyWordsLimitPage',
                        method: 'get',
                        params: {
                            userId: userIdmessage.innerHTML,
                            keyWords: searchmymp4contain.value,
                            pageNow: 1,
                            pageSize: 4,
                        }
                    })
                        .then(function (data) {
                            console.log(data.data.data.data)
                            console.log("8888888888888888888888")
                            myspcontain.innerHTML = ""
                            allpages.innerHTML = data.data.data.data.pageTotal;
                            nowpage.innerHTML = "1"
                            for (let i = 0; i < data.data.data.data.list.length; i++) {
                                myspcontain.innerHTML += `<div class="mysp">` +
                                    ` <input class="checkbox" type="checkbox">` +
                                    ` <video style="float: left; margin-left: 5%;margin-top: 1%" width="200" height="100" controls>` +
                                    ` <source src='${data.data.data.data.list[i].videoPath}' type="video/mp4">` +
                                    `</video>` +
                                    `<div style="height: 100%;margin-top: 0.4%;float: right;border: none;outline: none;width: 65%;">` +
                                    ` <p>` +
                                    ` <span>` + "视频名称：" + data.data.data.data.list[i].videoName + ` </span>` +
                                    ` <span>` + "创建人：" + data.data.data.data.list[i].nickName + ` </span>` +
                                    `</p>` +
                                    ` <p>` + "创建日期" + data.data.data.data.list[i].releaseTime + `</p>` +
                                    ` <p  class="changevideoid" style="display:none;">` + data.data.data.data.list[i].videoId + `</p>` +
                                    ` <p>` +
                                    `<button class="showvideomessage" style="color: #00cc36;">` + "修改信息" + `</button>` +
                                    `<button class="showvideoimg" style="color: #4e6ef2;">` + "修改图片" + `</button>` +
                                    `<button class="cancelvideobtn" style="color: #ff5c38;">` + "删除" + `</button>` +
                                    `</p>` +
                                    ` </div >` +

                                    ` </div >`
                            }
                            changevideo()



                        })
                        .catch(function (error) {
                            console.log(error)
                            console.log('在我的视频里面通过关键字查询视频失败')
                        })
                }

            }











            /*跳转页码?下一页！！！！ */
            var next = document.getElementsByClassName("next")[0];
          
            next.onclick = function () {
                /*首先判断搜索里是否有内容！！！ */
                if (searchmymp4contain.value!==""){
                    if (parseInt(nowpage.innerHTML) < parseInt(allpages.innerHTML) ) {
                        nowpage.innerHTML++;
                        myspcontain.innerHTML = ""
                        axios({
                            url: '/findVideoByLikeKeyWordsLimitPage',
                            method: 'get',
                            params: {
                                userId: userIdmessage.innerHTML,
                                pageSize: 4,
                                pageNow: nowpage.innerHTML,
                                keyWords: searchmymp4contain.value
                            }
                        })
                            .then(function (data) {
                                console.log(data.data.data.data)
                                for (let i = 0; i < data.data.data.data.list.length; i++) {
                                    myspcontain.innerHTML += ` 
                        <div class="mysp" >
                            <input class="checkbox" type="checkbox">
                                <video style="float: left; margin-left: 5%;margin-top: 1%" width="200" height="100" controls>
                                    <source src='${data.data.data.data.list[i].videoPath}'  type="video/mp4">
                                </video>
                                <div style="height: 100%;margin-top: 0.4%;float: right;border: none;outline: none;width: 65%;">
                                    <p>
                                        视频名称：${data.data.data.data.list[i].videoName}
                                    </p>
                                    <p>
                                        <span>创建人:${data.data.data.data.list[i].nickName}</span>
                                        <span style="margin-left: 10%;">创建日期:${data.data.data.data.list[i].releaseTime}</span>
                                    </p>
                                    <p class="changevideoid" style="display: none;">
                                    ${data.data.data.data.list[i].videoId}
                                    </p>
                                    <p>
                                        <button class="showvideomessage" style="color: #00cc36;">修改信息</button>
                                         <button class = "showvideoimg" style = "color: #4e6ef2;">修改图片</button>
                                        <button class="cancelvideobtn" style="color: #ff5c38;">删除</button>
                                    </p>
                                </div>
                            </div>
                    `
                                }


                                changevideo()
                            })
                            .catch(function (error) {
                                console.log(error)
                            })

                    } else {
                        // alert("无下一页")
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = "无下一页";
                    }
                }else{
                    if (parseInt(nowpage.innerHTML) < parseInt(allpages.innerHTML)) {
                        nowpage.innerHTML++;
                        myspcontain.innerHTML = ""
                        axios({
                            url: '/findAllVideoByUserId',
                            method: 'get',
                            params: {
                                userId: userIdmessage.innerHTML,
                                pageSize: 4,
                                pageNow: nowpage.innerHTML,
                            }
                        })
                            .then(function (data) {
                                for (let i = 0; i < data.data.data.data.list.length; i++) {
                                    myspcontain.innerHTML += ` 
                        <div class="mysp" >
                            <input class="checkbox" type="checkbox">
                                <video style="float: left; margin-left: 5%;margin-top: 1%" width="200" height="100" controls>
                                    <source src='${data.data.data.data.list[i].videoPath}'  type="video/mp4">
                                </video>
                                <div style="height: 100%;margin-top: 0.4%;float: right;border: none;outline: none;width: 65%;">
                                    <p>
                                        视频名称：${data.data.data.data.list[i].videoName}
                                    </p>
                                    <p>
                                        <span>创建人:${data.data.data.data.list[i].nickName}</span>
                                        <span style="margin-left: 10%;">创建日期:${data.data.data.data.list[i].releaseTime}</span>
                                    </p>
                                    <p class="changevideoid" style="display: none;">
                                    ${data.data.data.data.list[i].videoId}
                                    </p>
                                    <p>
                                        <button class="showvideomessage" style="color: #00cc36;">修改信息</button>
                                         <button class = "showvideoimg" style = "color: #4e6ef2;">修改图片</button>
                                        <button class="cancelvideobtn" style="color: #ff5c38;">删除</button>
                                    </p>
                                </div>
                            </div>          `              
                            }
                                changevideo()
                            })
                            .catch(function (error) {
                                console.log(error)
                            })

                    }else{
                        console.log(nowpage.innerText);
                        console.log(allpages.innerText);
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = "无下一页";
                    }
                }

                
            }



            /*跳转页码上一页！！！！ */
            var back = document.getElementsByClassName("back")[0];
            back.onclick = function () {
                if (searchmymp4contain.value !== "") {
                    if (nowpage.innerHTML>1) {
                        nowpage.innerHTML--;
                        myspcontain.innerHTML = ""
                        axios({
                            url: '/findVideoByLikeKeyWordsLimitPage',
                            method: 'get',
                            params: {
                                userId: userIdmessage.innerHTML,
                                pageSize: 4,
                                pageNow: nowpage.innerHTML,
                                keyWords: searchmymp4contain.value
                            }
                        })
                            .then(function (data) {
                                console.log(data.data.data.data)
                                for (let i = 0; i < data.data.data.data.list.length; i++) {
                                    myspcontain.innerHTML += ` 
                        <div class="mysp" >
                            <input class="checkbox" type="checkbox">
                                <video style="float: left; margin-left: 5%;margin-top: 1%" width="200" height="100" controls>
                                    <source src='${data.data.data.data.list[i].videoPath}'  type="video/mp4">
                                </video>
                                <div style="height: 100%;margin-top: 0.4%;float: right;border: none;outline: none;width: 65%;">
                                    <p>
                                        视频名称：${data.data.data.data.list[i].videoName}
                                    </p>
                                    <p>
                                        <span>创建人:${data.data.data.data.list[i].nickName}</span>
                                        <span style="margin-left: 10%;">创建日期:${data.data.data.data.list[i].releaseTime}</span>
                                    </p>
                                    <p class="changevideoid" style="display: none;">
                                    ${data.data.data.data.list[i].videoId}
                                    </p>
                                    <p>
                                        <button class="showvideomessage" style="color: #00cc36;">修改信息</button>
                                         <button class = "showvideoimg" style = "color: #4e6ef2;">修改图片</button>
                                        <button class="cancelvideobtn" style="color: #ff5c38;">删除</button>
                                    </p>
                                </div>
                            </div>
                    `
                                }

                                changevideo()


                            })
                            .catch(function (error) {
                                console.log(error)
                            })

                    } else {
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = "无上一页";
                    }
                } else {
                    // alert("搜索里面无内容")
                    // $('.prompt').show().delay(1000).fadeOut();
                    // prompt[0].innerText = "搜索里面无内容";
                    if (nowpage.innerHTML > 1) {
                        nowpage.innerHTML--;
                        myspcontain.innerHTML = ""
                        axios({
                            url: '/findAllVideoByUserId',
                            method: 'get',
                            params: {
                                userId: userIdmessage.innerHTML,
                                pageSize: 4,
                                pageNow: nowpage.innerHTML,
                            }
                        })
                            .then(function (data) {
                                for (let i = 0; i < data.data.data.data.list.length; i++) {
                                    myspcontain.innerHTML += ` 
                        <div class="mysp" >
                            <input class="checkbox" type="checkbox">
                                <video style="float: left; margin-left: 5%;margin-top: 1%" width="200" height="100" controls>
                                    <source src='${data.data.data.data.list[i].videoPath}'  type="video/mp4">
                                </video>
                                <div style="height: 100%;margin-top: 0.4%;float: right;border: none;outline: none;width: 65%;">
                                    <p>
                                        视频名称：${data.data.data.data.list[i].videoName}
                                    </p>
                                    <p>
                                        <span>创建人:${data.data.data.data.list[i].nickName}</span>
                                        <span style="margin-left: 10%;">创建日期:${data.data.data.data.list[i].releaseTime}</span>
                                    </p>
                                    <p class="changevideoid" style="display: none;">
                                    ${data.data.data.data.list[i].videoId}
                                    </p>
                                    <p>
                                        <button class="showvideomessage" style="color: #00cc36;">修改信息</button>
                                         <button class = "showvideoimg" style = "color: #4e6ef2;">修改图片</button>
                                        <button class="cancelvideobtn" style="color: #ff5c38;">删除</button>
                                    </p>
                                </div>
                            </div>
                    `
                                }
                            })
                            .catch(function (error) {
                                console.log(error)
                            })

                    } else {
                        // alert("无上一页")
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = "无上一页";
                    }
                    // alert("搜索里面无内容")
                    // $('.prompt').show().delay(1000).fadeOut();
                    // prompt[0].innerText = "搜索里面无内容";




                
            }
        }



            /*分页操作！前往第几页 */
            var yespage = document.getElementById("yespage");
            var topage = document.getElementsByClassName("topage")[0];
            yespage.onclick = function(){
                /*前往第几页 */
                /*首先判断搜索框是否有内容！！！ */
                if (searchmymp4contain.value !== "") {
                    nowpage.innerHTML = topage.value
                        myspcontain.innerHTML = ""
                        axios({
                            url: '/findVideoByLikeKeyWordsLimitPage',
                            method: 'get',
                            params: {
                                userId: userIdmessage.innerHTML,
                                pageSize: 4,
                                pageNow: topage.value,
                                keyWords: searchmymp4contain.value
                            }
                        })
                            .then(function (data) {
                                console.log(data.data.data.data)
                                for (let i = 0; i < data.data.data.data.list.length; i++) {
                                    myspcontain.innerHTML += ` 
                        <div class="mysp" >
                            <input class="checkbox" type="checkbox">
                                <video style="float: left; margin-left: 5%;margin-top: 1%" width="200" height="100" controls>
                                    <source src='${data.data.data.data.list[i].videoPath}'  type="video/mp4">
                                </video>
                                <div style="height: 100%;margin-top: 0.4%;float: right;border: none;outline: none;width: 65%;">
                                    <p>
                                        视频名称：${data.data.data.data.list[i].videoName}
                                    </p>
                                    <p>
                                        <span>创建人:${data.data.data.data.list[i].nickName}</span>
                                        <span style="margin-left: 10%;">创建日期:${data.data.data.data.list[i].releaseTime}</span>
                                    </p>
                                    <p class="changevideoid" style="display: none;">
                                    ${data.data.data.data.list[i].videoId}
                                    </p>
                                    <p>
                                        <button class="showvideomessage" style="color: #00cc36;">修改信息</button>
                                         <button class = "showvideoimg" style = "color: #4e6ef2;">修改图片</button>
                                        <button class="cancelvideobtn" style="color: #ff5c38;">删除</button>
                                    </p>
                                </div>
                            </div>
                    `
                                }
                            })
                            .catch(function (error) {
                                console.log(error)
                            })

                    } else {
                    if (parseInt(topage.value) > 0 && parseInt(topage.value) < parseInt(allpages.innerHTML + 1)) {
                        myspcontain.innerHTML = "";
                        nowpage.innerHTML = topage.value;
                        axios({
                            url: '/findAllVideoByUserId',
                            method: 'get',
                            params: {
                                userId: userIdmessage.innerHTML,
                                pageSize: 4,
                                pageNow: topage.value,
                            }
                        })
                            .then(function (data) {
                                for (let i = 0; i < data.data.data.data.list.length; i++) {
                                    myspcontain.innerHTML += ` 
                        <div class="mysp" >
                            <input class="checkbox" type="checkbox">
                                <video style="float: left; margin-left: 5%;margin-top: 1%" width="200" height="100" controls>
                                    <source src='${data.data.data.data.list[i].videoPath}'  type="video/mp4">
                                </video>
                                <div style="height: 100%;margin-top: 0.4%;float: right;border: none;outline: none;width: 65%;">
                                    <p>
                                        视频名称：${data.data.data.data.list[i].videoName}
                                    </p>
                                    <p>
                                        <span>创建人:${data.data.data.data.list[i].nickName}</span>
                                        <span style="margin-left: 10%;">创建日期:${data.data.data.data.list[i].releaseTime}</span>
                                    </p>
                                    <p class="changevideoid" style="display: none;">
                                    ${data.data.data.data.list[i].videoId}
                                    </p>
                                    <p>
                                        <button class="showvideomessage" style="color: #00cc36;">修改信息</button>
                                         <button class = "showvideoimg" style = "color: #4e6ef2;">修改图片</button>
                                        <button class="cancelvideobtn" style="color: #ff5c38;">删除</button>
                                    </p>
                                </div>
                            </div>
                    `
                                }
                            })
                            .catch(function (error) {
                                console.log(error)
                            })
                    } else {
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = "请输入正确的页码";
                    }

                    }
                    
            }

        } else if (i == 2) {
            containRightshangcdsjcontain.style.display = "none";
            
            containRightshangccontain.style.display = "none";
            mymp4contain.style.display = "none";
            auditcontain.style.display = "block";
            var allvideostatues = document.getElementsByClassName("allvideostatues")
            for (let i = 0; i < allvideostatues.length; i++) {
                if (allvideostatues[i].innerHTML.replace(/^\s*|\s*$/g, "") == "0") {
                    allvideostatues[i].innerHTML = "审核中"
                } else if (allvideostatues[i].innerHTML.replace(/^\s*|\s*$/g, "") == "1") {
                    allvideostatues[i].innerHTML = "审核通过"
                }else{
                    allvideostatues[i].innerHTML = "审核失败"
                    allvideostatues[i].style.color = "#ff5c38";
                }
            }


        }else{
            containRightshangccontain.style.display = "none";
            mymp4contain.style.display = "none";
            auditcontain.style.display = "none";
            containRightshangcdsjcontain.style.display = "block";
            var userid = document.getElementById("userid");
            userid.value = userIdmessage.innerHTML
            var addtvpath = document.getElementById("addtvpath");
            var alltvpath = document.getElementById("alltvpath");
            var dsjfile = document.getElementsByClassName("dsjfile");
            var allNumber = document.getElementById("allNumber");
            addtvpath.onclick = function(){
                if (dsjfile.length >= allNumber.value){
                    alert("集数不满足要求！")
                }else{
                    alltvpath.innerHTML += `
                    <input class="dsjfile" name="files" type="file">
                `
                }

            }

        }
        for (let i = 0; i < containRightTopli.length; i++) {
            containRightTopli[i].style.color = "black";
            containRightTopli[i].style.borderBottom = "none";
        }
        containRightTopli[i].style.color = "#00cc36";
        containRightTopli[i].style.borderBottom = "2px solid #00cc36";
    }
}

/*创作中心的审核进程的变色 */
var auditlis = document.getElementsByClassName("auditlis");
var allshenhevideo = document.getElementById("allshenhevideo");
var alreadyshenhevideo = document.getElementById("alreadyshenhevideo");
var ingshenhevideo = document.getElementById("ingshenhevideo");
var nogoshenhevideo = document.getElementById("nogoshenhevideo");
for (let i = 0; i < auditlis.length; i++) {
    auditlis[i].onclick = function () {
        hidesearchinput.style.display = "none";
        /*展示状况 */
        if (i == 0) {
            /*全部视频的审核状况 */
            allshenhevideo.style.display = "block";
            alreadyshenhevideo.style.display = "none";
            ingshenhevideo.style.display = "none";
            nogoshenhevideo.style.display = "none";

            var allvideostatues = document.getElementsByClassName("allvideostatues");
            for (let i = 0; i < allvideostatues.length;i++){
                console.log(allvideostatues[i].innerHTML.replace(/^\s*|\s*$/g, ""))
                if (allvideostatues[i].innerHTML.replace(/^\s*|\s*$/g, "")=="0"){
                    allvideostatues[i].innerHTML=="未通过"
                }else{
                    allvideostatues[i].innerHTML=="已通过"
                }
            }
        } else if (i == 1) {
            allshenhevideo.style.display = "none";
            alreadyshenhevideo.style.display = "block";
            ingshenhevideo.style.display = "none";
            nogoshenhevideo.style.display = "none";
        } else if (i == 2) {
            allshenhevideo.style.display = "none";
            alreadyshenhevideo.style.display = "none";
            ingshenhevideo.style.display = "block";
            nogoshenhevideo.style.display = "none";
        } else if (i == 3) {
            allshenhevideo.style.display = "none";
            alreadyshenhevideo.style.display = "none";
            ingshenhevideo.style.display = "none";
            nogoshenhevideo.style.display = "block";
        }

        for (let i = 0; i < auditlis.length; i++) {
            auditlis[i].style.color = "black";
        }
        auditlis[i].style.color = "#34BC6E"
    }
}




/*消息通知的标题变色 */
var containRightTopl = document.getElementsByClassName("l")
var updatamessagediv = document.getElementById("updatamessagediv");
var systemmessagediv = document.getElementById("systemmessagediv");
var othermessagediv = document.getElementById("othermessagediv");
var newfollowdiv = document.getElementById("newfollowdiv");
var receivegooddiv = document.getElementById("receivegooddiv");
for (let i = 0; i < containRightTopl.length; i++) {
    containRightTopl[i].onclick = function () {
        hidesearchinput.style.display = "none";
        /*判断i决定哪一块出现 */
        if (i == 0) {
            updatamessagediv.style.display = "block"
            systemmessagediv.style.display = "none"
            othermessagediv.style.display = "none"
            newfollowdiv.style.display = "none"
            receivegooddiv.style.display = "none"

        } else if (i == 1) {
            updatamessagediv.style.display = "none"
            systemmessagediv.style.display = "block"
            othermessagediv.style.display = "none"
            newfollowdiv.style.display = "none"
            receivegooddiv.style.display = "none"
        } else if (i == 2) {
            updatamessagediv.style.display = "none"
            systemmessagediv.style.display = "none"
            othermessagediv.style.display = "block"
            newfollowdiv.style.display = "none"
            receivegooddiv.style.display = "none"
        } else if (i == 3) {
            updatamessagediv.style.display = "none"
            systemmessagediv.style.display = "none"
            othermessagediv.style.display = "none"
            newfollowdiv.style.display = "block"
            receivegooddiv.style.display = "none"
        } else {
            updatamessagediv.style.display = "none"
            systemmessagediv.style.display = "none"
            othermessagediv.style.display = "none"
            newfollowdiv.style.display = "none"
            receivegooddiv.style.display = "block"
        }

        for (let i = 0; i < containRightTopl.length; i++) {
            containRightTopl[i].style.color = "black";
            containRightTopl[i].style.borderBottom = "none";
        }
        containRightTopl[i].style.color = "#00cc36";
        containRightTopl[i].style.borderBottom = "2px solid #00cc36";
    }
}



var wlcover = document.getElementById("wlcover");
var wl = document.getElementById("wl");
if (userIdmessage.innerHTML !== "") {
    closes.addEventListener("click", function () {
        /*首先判断是否是老用户！！！ */
        if (ifnewuser.innerHTML == "1") {
            /*出现一个挽留的弹窗！！！！ */
            wlcover.style.display = "block";   //显示遮罩层
            wl.style.display = "block";   //显示弹出层
            var yesclose = document.getElementById("yesclose");
            var noclose = document.getElementById("noclose");
            yesclose.onclick = function () {
                hidesearchinput.style.display = "none";
                cover.style.display = "none";
                modal.style.display = "none";
                wlcover.style.display = "none";   //显示遮罩层
                wl.style.display = "none";   //显示弹出层
            }
            noclose.onclick = function () {
                hidesearchinput.style.display = "none";
                wlcover.style.display = "none";   //显示遮罩层
                wl.style.display = "none";   //显示弹出层
            }
        } else {
          
            hidesearchinput.style.display = "none";
            cover.style.display = "none";
            modal.style.display = "none";
            wlcover.style.display = "none";   //显示遮罩层
            wl.style.display = "none";   //显示弹出层
        }



    })
} else {
    closes.addEventListener("click", function () {
        /*出现一个挽留的弹窗！！！！ */
        wlcover.style.display = "block";   //显示遮罩层
        wl.style.display = "block";   //显示弹出层
        var yesclose = document.getElementById("yesclose");
        var noclose = document.getElementById("noclose");
        yesclose.onclick = function () {
            hidesearchinput.style.display = "none";
            cover.style.display = "none";
            modal.style.display = "none";
            wlcover.style.display = "none";   //显示遮罩层
            wl.style.display = "none";   //显示弹出层
        }
        noclose.onclick = function () {
            hidesearchinput.style.display = "none";
            wlcover.style.display = "none";   //显示遮罩层
            wl.style.display = "none";   //显示弹出层
        }




    })
}


/* 点击下载列表，更新右侧内容！！！*/
// var hsistory = document.getElementById("hsistory");
// var sc = document.getElementById("sc");
// var sz = document.getElementById("sz");
// var xz = document.getElementById("xz");
// var containRight = document.getElementById("containRight");
// // var containRightlocal = document.getElementById("containRightlocal");
// var containRightsc = document.getElementById("containRightsc");
// var containRightsz = document.getElementById("containRightsz");
// var szhang = document.getElementById("szhang");
// var changzuo = document.getElementById("changzuo");
// var messagee = document.getElementById("messagee");
// var containRightmessage = document.getElementById("containRightmessage");
// var containRightxz = document.getElementById("containRightxz");
// var containRightjfdh = document.getElementById("containRightjfdh");
// var containRightshangc = document.getElementById("containRightshangc");











var qd = document.getElementById("qd").querySelector("span");
var alljf = document.getElementById("alljf");
qd.onclick = function () {
    /*首先判断是否登录，如果没有登录先登录，登录之后进行判断是否已经签到！！！！ */
    if (userIdmessage.innerHTML == "") {
        $('.prompt').show().delay(1000).fadeOut();
        prompt[0].innerText = "尚未登录，不可以进行签到";
    } else {
        hidesearchinput.style.display = "none";
        if (qd.innerHTML.replace(/^\s*|\s*$/g, "") == "签到") {
            /*进行加分环节 */
            qd.innerHTML = "已签到";
            document.getElementById("qd").style.cursor = " not-allowed";
            qd.style.color = "black";
            jf.style.display = "none";
            axios({
                url: '/SignIn',
                method: 'post',
                params: {
                    userId: userIdmessage.innerHTML,
                }
            })
                .then(function (data) {
                    console.log(data)
                    $('.prompt').show().delay(1000).fadeOut();
                    prompt[0].innerText = "签到成功";
                    window.location.reload();
                })
                .catch(function (error) {
                    console.log(error)
                    console.log('进行签到失败')
                })
        } else {

            document.getElementById("qd").style.cursor = " not-allowed";
        }

    }


}

/*切换账号的操作！！！！ */

var morezhcover = document.getElementById("morezhcover");
var morezh = document.getElementById("morezh");
toontherzh.onclick = function () {
    hidesearchinput.style.display = "none";
    morezhcover.style.display = "block";
    morezh.style.display = "block";
}

var closemorezh = document.getElementById("closemorezh");
closemorezh.onclick = function () {
    hidesearchinput.style.display = "none";
    morezhcover.style.display = "none";
    morezh.style.display = "none";
}
var nomore = document.getElementById("nomore");
nomore.onclick = function () {
    hidesearchinput.style.display = "none";
    morezhcover.style.display = "none";
    morezh.style.display = "none";
}





var vipidall = document.getElementsByClassName("vipid");
/*点击去支付 */
var payapplybtn = document.getElementById("payapplybtn");
console.log(payapplybtn)
payapplybtn.onclick = function () {

    if (userIdmessage.innerHTML == "") {
        $('.prompt').show().delay(1000).fadeOut();
        prompt[0].innerText = "尚未登录，请先登录";
    } else {
        /*登录之后先进行查询积分，然后如果签到就进行签到 */
        console.log(allonevipdivall)
        for (let i = 0; i < allonevipdivall.length; i++) {
            if (allonevipdivall[i].style.background !== "") {
                var vipId = vipidall[i].innerHTML.replace(/^\s*|\s*$/g, "")

                axios({
                    url: '/addPayOrder',
                    method: 'post',
                    params: {
                        vipId: vipId,
                        userId: userIdmessage.innerHTML,
                    }
                })
                    .then(function (data) {
                        console.log(data.data.data.object.payVipOrderId)
                        console.log("添加订单成功")
                        /*添加订单成功之后进行遍历订单获取订单信息 */


                        axios({
                            url: '/findOrderInnerJoinUser',
                            method: 'get',
                            params: {
                                payVipOrderId: data.data.data.object.payVipOrderId,
                            }
                        })
                            .then(function (data) {
                                console.log(data.data.data.object)
                                var payNo = data.data.data.object.payNo  //订单号码
                                var userName = data.data.data.object.userName  //订单人
                                var goodsName = data.data.data.object.goodsName  //订单vip类型名称
                                var nowPrice = data.data.data.object.nowPrice  //订单价格
                                var payVipOrderId = data.data.data.object.payVipOrderId  //订单id

                                /*进行支付 */
                                axios({
                                    url: '/payFor',
                                    method: 'get',
                                    params: {
                                        payVipOrderId: data.data.data.object.payVipOrderId,
                                    }
                                })
                                    .then(function (data) {

                                        window.location.href = 'http://42.194.158.211:8080/video/alipay/payFor?payVipOrderId' + '=' + `${payVipOrderId}`

                                        /*存储 */
                                        localStorage.setItem("payVipOrderId", `${payVipOrderId}`);


                                    })
                                    .catch(function (error) {
                                        console.log(error)
                                        console.log('支付订单失败')
                                    })

                            })
                            .catch(function (error) {
                                console.log(error)
                                console.log('遍历支付订单失败')
                            })



                    })
                    .catch(function (error) {
                        console.log(error)
                        console.log('添加订单失败')
                    })



            }
        }
    }
}







var allwaysdivs = document.getElementById("hhh").querySelectorAll("div");
var allwaysbuttons = document.getElementById("hhh").querySelectorAll("button");
var money = document.getElementById("money");


/*轮播图 */
var btn = document.getElementById("btn");
var hhh = document.getElementById("hhh");
var leftbtn = document.getElementById("leftbtn");
btn.addEventListener("click",function(){
    if (ifnewuser.innerHTML == "1") {
        /*新用户 */
        if (hhh.style.marginLeft == "") {
            console.log("1444222")
            hhh.style.marginLeft = "-645px";
            hhh.style.transition = "all 1s";
            btn.style.display = "block";
            leftbtn.style.display = "block";
        } else {
            console.log("123")
            hhh.style.marginLeft = "-1290px";
            hhh.style.transition = "all 1s";
            btn.style.display = "none";
            leftbtn.style.display = "block";
        }
    }else{
        /*老用户 */
        hhh.style.marginLeft = "-645px";
        hhh.style.transition = "all 1s";
        btn.style.display = "none";
        leftbtn.style.display = "block";
    }

})



leftbtn.onclick = function () {
    if (ifnewuser.innerHTML=="1"){
        /*新用户 */
        if (hhh.style.marginLeft == "-1290px") {
            hhh.style.marginLeft = "-645px";
            hhh.style.transition = "all 1s";
            btn.style.display = "block";
            leftbtn.style.display = "block";
        } else {
            hhh.style.marginLeft = "";
            hhh.style.transition = "all 1s";
            btn.style.display = "block";
            leftbtn.style.display = "none";
        }
    }else{
        hhh.style.marginLeft = "";
        hhh.style.transition = "all 1s";
        btn.style.display = "block";
        leftbtn.style.display = "none";
        /*老用户 */


    }


}


/*设置中心里面的基本信息与安全中心与消息设置的三种内容的变化 */
// var messagecontain = document.getElementById("messagecontain");//消息设置
var personmessage = document.getElementById("personmessage");//基本信息设置
var safeCenter = document.getElementById("safeCenter");//安全中心设置

// var message = document.getElementById("message") 
var person = document.getElementById("person")
var safe = document.getElementById("safe")



person.onclick = function () {
    hidesearchinput.style.display = "none";
    safeCenter.style.display = "none";
    safe.style.color = "black";
    safe.style.borderBottom = "none";
    // message.style.color = "black";
    // messagecontain.style.display = "none";
    personmessage.style.display = "block";
    person.style.color = "#00cc36";
    person.style.borderBottom = "2px solid #00cc36";
    // message.style.borderBottom = "none";
}
safe.onclick = function () {
    hidesearchinput.style.display = "none";
    safeCenter.style.display = "block";
    safe.style.color = "#00cc36";
    safe.style.borderBottom = "2px solid #00cc36";
    // message.style.color = "black";
    // messagecontain.style.display = "none";
    personmessage.style.display = "none";
    person.style.color = "black";
    person.style.borderBottom = "none";
    // message.style.borderBottom = "none";
}
/*立即开通vip */
var nowvip = document.getElementById("nowvip");
nowvip.onclick = function () {
    hidesearchinput.style.display = "none";
    cover.style.display = "block";   //显示遮罩层
    modal.style.display = "block";   //显示弹出层
}


/*切换照片！！！！或者将这个照片进行旋转 */
var qb = document.getElementById("qb");
var hideqb = document.getElementById("hideqb");
var show = document.getElementById("show");


qb.onclick = function () {
    hidesearchinput.style.display = "none";
    if (hideqb.style.display == "none") {
        hideqb.style.display = "block";
    } else {
        hideqb.style.display = "none";
    }


}



/*更换头像的框！！！*/
var changeheadimg = document.getElementById("changeheadimg");
var headimgcover = document.getElementById("headimgcover");
var changehead = document.getElementById("changehead");
changeheadimg.onclick = function () {
    hidesearchinput.style.display = "none";
    headimgcover.style.display = "block";
    changehead.style.display = "block";
}
function headimg() {
    headimgcover.style.display = "block";
    changehead.style.display = "block";
}
/*左侧栏进行更换头像的操作！！！ */

navchangeimg.onclick = function () {
    if(userIdmessage.innerHTML==""){
        $('.prompt').show().delay(1000).fadeOut();
        prompt[0].innerText = "尚未登录，不可进行更换头像";
    }else{
        headimg()
        hidesearchinput.style.display = "none";
    }

}
var mymessageheadimg = document.getElementById("mymessageheadimg");
mymessageheadimg.onclick = function () {
    headimg()
    hidesearchinput.style.display = "none";
}

vipviewheadimg.onclick = function () {
    hidesearchinput.style.display = "none";
    headimg()
}


var closeimg = document.getElementById("closeimg");
closeimg.onclick = function () {
    hidesearchinput.style.display = "none";
    headimgcover.style.display = "none";
    changehead.style.display = "none";
}










var newheadimg = document.getElementById("newheadimg");
// var bigheadimg = document.getElementsByClassName("bigheadimg");
// var someheadimg = document.getElementsByClassName("someheadimg");
var changehead = document.getElementById("changehead")
newheadimg.onclick = function () {
    /*点击保存按钮，先进行判断是否已经登录，登录之后进行更改头像的操作！！！！ */
    hidesearchinput.style.display = "none";
    headimgcover.style.display = "none";
    changehead.style.display = "none";
    var mymessageheadimg = document.getElementById("mymessageheadimg");
    window.location.reload()
}





/*批量操作！！！ */
/*批量管理 */
var plgl = document.getElementById("plgl");
var cz = document.getElementById("cz");
plgl.onclick = function () {
    plgl.style.display = "none";
    cz.style.display = "block";

    var inputcheckboxs = document.getElementsByClassName("inputcheckbox");
    for (let i = 0; i < inputcheckboxs.length;i++){
        inputcheckboxs[i].style.display="block"
    }


    /*继续全部删除操作！！！ */
    var cancelallvideo = document.getElementsByClassName("cancelallvideo")[0];
    cancelallvideo.onclick = function () {
        for (let i = 0; i < inputcheckboxs.length; i++) {
            inputcheckboxs[i].checked = true
            var cancelsomebtn = document.getElementsByClassName("cancelsomebtn")[0];
            cancelsomebtn.style.border = "1px solid #00cc36"
        }
    }






}
/*取消批量操作 */
var qxpl = document.getElementById("qxpl");
qxpl.onclick = function(){
    plgl.style.display = "block";
    cz.style.display = "none";

    var inputcheckboxs = document.getElementsByClassName("inputcheckbox");
    for (let i = 0; i < inputcheckboxs.length; i++) {
        inputcheckboxs[i].style.display = "none"
    }


}

/*批量删除历史记录 */

/*进行删除操作 */
var cancelsomebtn = document.getElementsByClassName("cancelsomebtn")[0];

var inputcheckboxs = document.getElementsByClassName("inputcheckbox");
cancelsomebtn.onclick = function(){
    var cancelsomevidearray =""
    /*点击删除进行获取所有要进行删除的视频id */
    for (let i = 0; i < inputcheckboxs.length; i++) {
        if (inputcheckboxs[i].checked == true){
            var videoIdones = document.getElementsByClassName("videoIdone");
            console.log(videoIdones[0].innerHTML)
            cancelsomevidearray += videoIdones[i].innerHTML.replace(/^\s*|\s*$/g, "") + ",";
            console.log(cancelsomevidearray)
        }
    }
    cancelsomevidearrays = cancelsomevidearray.substring(0, cancelsomevidearray.length-1);


    // alert(cancelsomevidearrays)

    axios({
        url: '/deleteRecordList',
        method: 'delete',
        params: {
            historyRecordId: cancelsomevidearrays,
        }

    })
        .then(function (data) {
            console.log("全部删除成功")
            /*删除之后刷新页面 */
            window.location.href ="/myperson?1"
        })
        .catch(function (error) {
            console.log(error)
            console.log('失败')
        })
}







/*进行批量删除的操作 */
var cancelallvideo = document.getElementsByClassName("cancelallvideo")[0];
cancelallvideo.onclick = function () {


    axios({
        url: '/deleteMoreMyVideos',
        method: 'delete',
        params: {
            videoIds: historyidss,
        }

    })
        .then(function (data) {
            console.log("批量删除成功")
        })
        .catch(function (error) {
            console.log(error)
            console.log('失败')
        })
}




/*个人中心中对于性别的修改 */
var allsex = document.getElementById("allsex");
var editsex = document.getElementById("editsex");
var closesex = document.getElementById("closesex");
var newsex = document.getElementById("newsex");
var nowsex = document.getElementById("nowsex");
var sex = nowsex.querySelector("input");

var nan = document.getElementById("nan");
var nu = document.getElementById("nu");


editsex.onclick = function () {
    hidesearchinput.style.display = "none";
    var oldsex = sex.value
    if (oldsex == "男") {
        $("#nan").prop('checked', true);
    } else {
        $("#nu").prop('checked', true);
    }
    allsex.style.display = "block";
    newsex.style.display = "block";
    closesex.style.display = "block";
    nowsex.style.display = "none";
    editsex.style.display = "none";
    /*点击取消按钮！！！ */
    closesex.onclick = function () {
        hidesearchinput.style.display = "none";
        sex.value = oldsex;
        allsex.style.display = "none";
        newsex.style.display = "none";
        closesex.style.display = "none";
        nowsex.style.display = "block";
        editsex.style.display = "block";

    }
}

/*vip */
var vipbz = document.getElementById("vipbz");
var vipts = document.getElementById("vipts");
vipbz.onmouseover = function () {
    vipts.style.display = "block"
}
vipbz.onmouseout = function () {
    vipts.style.display = "none"
}
vipbz.onclick = function () {

    if(userIdmessage.innerHTML==""){
        wordone.style.display="none";
        wordtwo.style.display = "none";
        hidesearchinput.style.display = "none";
        /*点击之后开通vip的弹窗出现！！！！ */
        cover.style.display = "block";   //显示遮罩层
        modal.style.display = "block";   //显示弹出层
    }else{
        hidesearchinput.style.display = "none";
        cover.style.display = "block";   //显示遮罩层
        modal.style.display = "block";   //显示弹出层
    }

}








/*删除所有的历史记录 */
// var cancelallhistory = document.getElementById("cancelallhistory");

// var noallcancel = document.getElementById("noallcancel");
// cancelallhistory.onclick = function () {
//     hidesearchinput.style.display = "none";
//     cancelalltc.style.display = "block";
//     logincover.style.display = "block";
//     noallcancel.onclick = function(){
//         var historyids = "";
//         var videoIds = document.getElementsByClassName("videoIdone");
//         console.log(videoIds)
//         for (var i = 0; i < videoIds.length;i++){
//             historyids += videoIds[i].innerHTML+ ",";

//         }
//         historyidss = historyids.substring(0, historyids.length - 1);


//         alert(historyidss)

//         /*获取全部的视频id */
        // axios({
        //     url: '/deleteRecordList',
        //     method: 'delete',
        //     params:{
        //         historyRecordId: historyidss,
        //     }

        // })
        //     .then(function (data) {
        //         console.log("全部删除成功")
        //     })
        //     .catch(function (error) {
        //         console.log(error)
        //         console.log('失败')
        //     })



//     }
// }
// var closeallhistory = document.getElementById("closeallhistory");
// closeallhistory.onclick = function () {
//     hidesearchinput.style.display = "none";
//     cancelalltc.style.display = "none";
//     logincover.style.display = "none";
// }
// var yesallcancel = document.getElementById("yesallcancel");
// var noallcancel = document.getElementById("noallcancel");
// noallcancel.onclick = function () {
//     hidesearchinput.style.display = "none";
//     cancelalltc.style.display = "none";
//     logincover.style.display = "none";
// }
// yesallcancel.onclick = function () {
//     hidesearchinput.style.display = "none";
//     /*此处应该还进行删除所有历史记录的操作！！！ */
//     cancelalltc.style.display = "none";
//     logincover.style.display = "none";
// }






var closeallmp4 = document.getElementById("closeallmp4");
closeallmp4.onclick = function () {
    hidesearchinput.style.display = "none";
    cancelallsp.style.display = "none";
    logincover.style.display = "none"
}
var yesallcancelsp = document.getElementById("yesallcancelsp");

yesallcancelsp.onclick = function () {
    hidesearchinput.style.display = "none";
    /*此处应该还进行删除所有历史记录的操作！！！ */
    cancelallsp.style.display = "none";
    logincover.style.display = "none"
}





var closeallhistory = document.getElementById("closeallhistory");
closeallhistory.onclick = function () {
    hidesearchinput.style.display = "none";
    cancelalltc.style.display = "none";
    logincover.style.display = "none"
}
/*导航栏头像下拉栏 */
var showhide = document.getElementById("showhide");
var headimgHide = document.getElementById("headimgHide");

var iflogin = document.getElementById("iflogin").querySelector("a");








var toout = document.getElementById("toout");
var tologin = document.getElementById("tologin");
showhide.onclick = function () {
    hidesearchinput.style.display = "none";
    if (userIdmessage.innerHTML == "") {
        iflogin.innerHTML="尚未登录"
        toout.style.display = "none";
        tologin.style.display = "block"
    } else {
        tologin.style.display = "none"
        toout.style.display = "block";
    }
    if (headimgHide.style.display == "none") {
        headimgHide.style.display = "block";
    } else {
        headimgHide.style.display = "none"
    }
}
/*点击退出！！！ */
toout.onclick = function () {
    hidesearchinput.style.display = "none";
    axios({
        url: '/logout',
        method: 'post',
    })
        .then(function (data) {
            console.log(data)
            console.log("退出账号成功！！！")
            window.location.href = "/index"
            userIdmessage.innerHTML = localStorage.removeItem("userid")
        })
        .catch(function (error) {
            console.log(error)
            console.log('失败')
        })
}


/*导航栏头像隐藏下拉栏的开通会员 */
var hidebutton = document.getElementById("hidebutton");
hidebutton.onclick = function () {
    hidesearchinput.style.display = "none";
    /*点开隐藏框的时候直接隐藏下拉栏 */
    headimgHide.style.display = "none";
    cover.style.display = "block";   //显示遮罩层
    modal.style.display = "block";   //显示弹出层
    var wlcover = document.getElementById("wlcover");
    var wl = document.getElementById("wl");
}










// var oldsex = sex.value
// if (oldsex == "男") {
//     console.log("男")
//     $("#nan").prop('checked', true);
// } else {
//     console.log("女")
//     $("#nu").prop('checked', true);
// }

/*修改昵称的地方 */
var editname = document.getElementById("editname");
var nowname = document.getElementById("nowname");
var newname = document.getElementById("newname");

var oldname = document.getElementById("oldname");
editname.onclick = function () {
        hidesearchinput.style.display = "none";
        editname.style.display = "none";
        document.getElementById("nowname").disabled = "";
        nowname.style.border = "1px solid black";
        newname.style.display = "block";
        oldname.style.display = "block";
        /*点击取消按钮的时候 */
        oldname.addEventListener("click", function () {
            hidesearchinput.style.display = "none";
            oldname.style.display = "none";
            newname.style.display = "none";
            editname.style.display = "block";
            nowname.value = topname.innerHTML;
            nowname.style.border = "none";
            document.getElementById("nowname").disabled = "disabled";
        })
        /*点击保存按钮的时候 */
        newname.addEventListener("click", function () {

            
            /*点击保存进行更改昵称！！！！ */
            hidesearchinput.style.display = "none";
            oldname.style.display = "none";
            editname.style.display = "block";
            var nname = nowname.value;
            // alert(nname)
            axios({
                url: '/updateUsername',
                method: 'put',
                params: {
                    userId: userIdmessage.innerHTML,
                    nickname: nname,
                }
            })
                .then(function (data) {
                    console.log(data)
                    console.log("1111111111111111111111111111111111111111111")
                    nowname.style.border="none"
                    editname.style.display="block"
                    oldname.style.display = "none"
                    newname.style.display = "none"
                    axios({
                        url: '/findUserById',
                        method: 'get',
                        params: {
                            userId: userIdmessage.innerHTML,
                        }
                    })
                        .then(function (data) {
                            console.log(data.data.data.object.nickname)
                            console.log("获取用户个人信息成功")
                            if (data.data.data.object.nickname.length > 5) {
                                var lastnickname = data.data.data.object.nickname.replace(/^\s*|\s*$/g, "").substring(0, 5) + "...";
                                vipnickname.innerHTML = lastnickname
                                topname.innerHTML = data.data.data.object.nickname
                                leftnickname.innerHTML = lastnickname
                                console.log(leftnickname.innerHTML)
                                var iflogin = document.getElementById("iflogin");
                                iflogin.innerHTML = lastnickname
                                var nowname = document.getElementById("nowname")
                                nowname.value = data.data.data.object.nickname

                            } else {
                                 var nowname = document.getElementById("nowname")
                                nowname.value = data.data.data.object.nickname
                                vipnickname.innerHTML = data.data.data.object.nickname
                                topname.innerHTML = data.data.data.object.nickname
                                leftnickname.innerHTML = data.data.data.object.nickname
                                var iflogin = document.getElementById("iflogin");
                                iflogin.innerHTML = data.data.data.object.nickname
                                nowname.value = data.data.data.object.nickname
                            }



                            

                        })
                        .catch(function (error) {
                            console.log(error)
                            console.log('失败')
                        })
                })
                .catch(function (error) {
                    console.log(error)
                    console.log('修改用户昵称失败')
                })

        })
    

}


/*修改简介的地方 */
var editjj = document.getElementById("editjj");
var newjj = document.getElementById("newjj");
var oldjj = document.getElementById("oldjj");
editjj.onclick = function () {
    hidesearchinput.style.display = "none";
    editjj.style.display = "none";
    document.getElementById("nowjj").disabled = "";
    nowjj.style.border = "1px solid black";
    newjj.style.display = "block";
    oldjj.style.display = "block";
    /*点击取消按钮的时候 */
    oldjj.onclick = function () {
        hidesearchinput.style.display = "none";
        oldjj.style.display = "none";
        newjj.style.display = "none";
        editjj.style.display = "block";
        document.getElementById("nowjj").disabled = "disabled";
        nowjj.style.border = "none";
    }
    /*点击保存按钮的时候 */
    newjj.onclick = function () {
        axios({
            url: '/updateUserIntroduction',
            method: 'put',
            params: {
                userId: userIdmessage.innerHTML,/*用户id */
                Introduction: nowjj.value,/*vipid */
            }
        })
            .then(function (data) {
                console.log(data)
                hidesearchinput.style.display = "none";
                newjj.style.display = "none";
                oldjj.style.display = "none";
                editjj.style.display = "block";
                document.getElementById("nowjj").disabled = "disabled";
                nowjj.style.border = "none";
             
                axios({
                    url: '/findUserById',
                    method: 'get',
                    params: {
                        userId: userIdmessage.innerHTML,
                    }
                })
                    .then(function (data) {
                        console.log(data.data.data.object)
                        console.log("获取用户个人信息成功")

                        /*头像的遍历 */
                            navchangeimg.src = data.data.data.object.src
                            topheadimg.src = data.data.data.object.src
                            mymessageheadimg.src = data.data.data.object.src
                            vipviewheadimg.src = data.data.data.object.src
    

                        /*用户昵称的遍历 */

                        console.log(data.data.data.object.nickname.length)
                        var vipnickname = document.getElementById("vipnickname");
                        var iflogin = document.getElementById("iflogin")
                        if (data.data.data.object.nickname.length > 5) {
                            var lastnickname = data.data.data.object.nickname.replace(/^\s*|\s*$/g, "").substring(0, 5) + "...";
                            vipnickname.innerHTML = lastnickname
                            topname.innerHTML = data.data.data.object.nickname
                            leftnickname.innerHTML = lastnickname
                            console.log(leftnickname.innerHTML)
                            iflogin.innerHTML = lastnickname
                            var nowname = document.getElementById("nowname")
                            nowname.value = data.data.data.object.nickname

                        } else {
                            vipnickname.innerHTML = data.data.data.object.nickname
                            topname.innerHTML = data.data.data.object.nickname
                            leftnickname.innerHTML = data.data.data.object.nickname
                            console.log(leftnickname.innerHTML)
                            iflogin.innerHTML = data.data.data.object.nickname
                            var nowname = document.getElementById("nowname")
                            nowname.value = data.data.data.object.nickname
                        }

        

                        /*性别 */
                        var nowsex = document.getElementById("nowsex").querySelector("input")
                        nowsex.value = data.data.data.object.sex

                        /*是否是视频号 */
                        // videoNumber   0不是视频号   1是视频号
                        var ifsphuser = document.getElementById("ifsphuser");
                        ifsphuser.innerHTML = data.data.data.object.videoNumber;
                        if (ifsphuser.innerHTML == "0") {
                            console.log("不是视频号")
                        } else {
                            console.log("是视频号")
                        }




                        /*性别的遍历 */
                        nowsex.value = data.data.data.object.sex
                        /*关注与粉丝总数的遍历 */
                        /*简介的遍历 */
                        nowjj.value = data.data.data.object.introduction
                        /*vip等级以及vip天数的遍历 */

                        viptype.innerHTML = data.data.data.object.vip;

                        var getemail = document.getElementById("getemail");
                        /*邮箱的遍历 */
                        var ifbindemail = document.getElementById("ifbindemail");/*是否绑定邮箱 */
                        if (data.data.data.object.email == "") {
                            ifbindemail.innerHTML = "尚未绑定邮箱"
                            getemail.innerHTML = "绑定邮箱"
                        } else {
                            ifbindemail.innerHTML = data.data.data.object.email
                            getemail.innerHTML = "更改邮箱"
                        }
                        var loginpasswordinput = document.getElementById("loginpasswordinput");/*用户密码的遍历 */
                        loginpasswordinput.innerHTML = "**********"


                        /*账号与邮箱的遍历！！！！ */
                        // var vipaccount = document.getElementById("vipaccount");
                        console.log(data.data.data.object.account);
                        // if (data.data.data.object.account == "") {
                        //     vipaccount.innerHTML = "邮箱注册无账号"
                        //     vipaccount.style.fontSize = "0.8em"
                        // } else {
                            // vipaccount.innerHTML = data.data.data.object.account
                            // vipaccount.style.fontSize = "0.8em"
                        // }


                        /*手镯 */




                        /*判断是否是会员 */
                        var tovip = document.getElementById("tovip");
                        var novipimg = document.getElementById("novipimg");
                        var havevipimg = document.getElementById("havevipimg");
                        var wordone = document.getElementById("wordone");
                        var wordtwo = document.getElementById("wordtwo");
                        var loginuserid = userIdmessage.innerHTML;
                        var szviptype = document.getElementById("szviptype");
                        var nowvip = document.getElementById("nowvip");
                        // alert(viptype.innerHTML)
                        if (viptype.innerHTML == "0") {
                            console.log("普通用户")
                            tovip.innerHTML = "开通会员"
                            novipimg.style.display = "block";
                            havevipimg.style.display = "none";
                            wordtwo.style.display = "block"
                            wordone.style.display = "none"
                            szviptype.innerHTML = "您尚未开通任何会员"
                            nowvip.innerHTML = "立即开通vip"
                        } else {
                            console.log("vip用户")
                            tovip.innerHTML = "续费会员"
                            novipimg.style.display = "none";
                            havevipimg.style.display = "block";
                            wordone.style.display = "block"
                            wordtwo.style.display = "none"
                            szviptype.innerHTML = "您已开通黄金vip"
                            szviptype.style.color = "#e3b54c"
                            nowvip.innerHTML = "立即续费vip"
                        }






                    })
                    .catch(function (error) {
                        console.log(error)
                        console.log('失败')
                    })


            })
            .catch(function (error) {
                console.log(error)
                console.log('失败')
            })






    }
}




/*登陆状态的更改密码操作 */

// var logincover = document.getElementById("logincover");
// var loginmodal = document.getElementById("loginmodal");


// var logintoregister = document.getElementById("logintoregister")
// var logintopassword = document.getElementById("logintopassword")
// /*登录到注册跟忘记密码！！！*/
// logintoregister.onclick = function(){
//     loginthrer.style.display = "none";
//     newpasswordthere.style.display = "none";
//     registerthere.style.display = "block";
//     loginmodal.style.height="400px";
// }
// logintopassword.onclick = function () {
// loginthrer.style.display = "none";
// newpasswordthere.style.display = "block";
// registerthere.style.display = "none";
// loginmodal.style.height = "400px";
// }
/*从注册到更改密码跟登录 */

/*邮箱注册 */
var emailregister = document.getElementById("emailregister")//邮箱注册
var changepassword = document.getElementById("changepassword");//忘记密码
var emailpasswordlogin = document.getElementById("emailpasswordlogin");//邮箱密码登录
var selfaccountregister = document.getElementById("selfaccountregister");//自定义账号注册
var emailcodelogin = document.getElementById("emailcodelogin");//邮箱验证码登录
var selfaccountlogin = document.getElementById("selfaccountlogin");//自定义账号登录

var emailcodeloginthere = document.getElementById("emailcodeloginthere");//邮箱验证码登录
var selfaccountregisterthere = document.getElementById("selfaccountregisterthere");//自定义账户注册
var selfaccountloginthere = document.getElementById("selfaccountloginthere");//自定义账号登录
var loginthrer = document.getElementById("loginthrer");//邮箱密码登录
var registerthere = document.getElementById("registerthere");//邮箱注册
var newpasswordthere = document.getElementById("newpasswordthere");//忘记密码

emailregister.onclick = function () {
    logincover.style.display = "block";
    loginmodal.style.height = "400px"
    hidesearchinput.style.display = "none";
    emailregister.style.color = "white";
    emailregister.style.backgroundColor = "#00a1d6";
    emailpasswordlogin.style.backgroundColor = "transparent";
    changepassword.style.backgroundColor = "transparent";
    selfaccountregister.style.backgroundColor = "transparent";
    emailcodelogin.style.backgroundColor = "transparent";
    selfaccountlogin.style.backgroundColor = "transparent";
    emailpasswordlogin.style.color = "#666";
    changepassword.style.color = "#666";
    selfaccountregister.style.color = "#666";
    emailcodelogin.style.color = "#666";
    selfaccountlogin.style.color = "#666";
    loginthrer.style.display = "none";
    newpasswordthere.style.display = "none";
    registerthere.style.display = "block";
    emailcodeloginthere.style.display = "none";
    selfaccountregisterthere.style.display = "none";
    selfaccountloginthere.style.display = "none";
}
/*更改密码 */

changepassword.onclick = function () {
    logincover.style.display = "block";
    loginmodal.style.height = "400px"
    hidesearchinput.style.display = "none";
    emailregister.style.color = "#666";
    emailpasswordlogin.style.color = "#666";
    changepassword.style.color = "white";
    changepassword.style.backgroundColor = "#00a1d6";
    emailpasswordlogin.style.backgroundColor = "transparent";
    emailregister.style.backgroundColor = "transparent";
    selfaccountregister.style.backgroundColor = "transparent";
    emailcodelogin.style.backgroundColor = "transparent";
    selfaccountlogin.style.backgroundColor = "transparent";

    selfaccountregister.style.color = "#666";
    emailcodelogin.style.color = "#666";
    selfaccountlogin.style.color = "#666";
    loginthrer.style.display = "none";
    newpasswordthere.style.display = "block";
    registerthere.style.display = "none";
    emailcodeloginthere.style.display = "none";
    selfaccountregisterthere.style.display = "none";
    selfaccountloginthere.style.display = "none";

}
/*邮箱密码登录 */

emailpasswordlogin.onclick = function () {
    logincover.style.display = "block";
    loginmodal.style.height = "300px"
    hidesearchinput.style.display = "none";
    loginthrer.style.display = "block";
    newpasswordthere.style.display = "none";
    registerthere.style.display = "none";
    emailcodeloginthere.style.display = "none";
    selfaccountregisterthere.style.display = "none";
    selfaccountloginthere.style.display = "none";

    emailregister.style.color = "#666";
    emailpasswordlogin.style.color = "white";
    emailpasswordlogin.style.backgroundColor = "#00a1d6";
    changepassword.style.backgroundColor = "transparent";
    emailregister.style.backgroundColor = "transparent";
    selfaccountregister.style.backgroundColor = "transparent";
    emailcodelogin.style.backgroundColor = "transparent";
    selfaccountlogin.style.backgroundColor = "transparent";
    changepassword.style.color = "#666";
    selfaccountregister.style.color = "#666";
    emailcodelogin.style.color = "#666";
    selfaccountlogin.style.color = "#666";

}
/*邮箱验证码登录 */

emailcodelogin.onclick = function () {
    logincover.style.display = "block";
    loginmodal.style.height = "300px"
    hidesearchinput.style.display = "none";
    loginthrer.style.display = "none";
    newpasswordthere.style.display = "none";
    registerthere.style.display = "none";
    emailcodeloginthere.style.display = "block";
    selfaccountregisterthere.style.display = "none";
    selfaccountloginthere.style.display = "none";
    emailregister.style.color = "#666";
    emailpasswordlogin.style.color = "#666";
    changepassword.style.color = "#666";
    selfaccountregister.style.color = "#666";
    emailcodelogin.style.color = "white";
    emailcodelogin.style.backgroundColor = "transparent";
    emailpasswordlogin.style.backgroundColor = "transparent";
    emailregister.style.backgroundColor = "transparent";
    selfaccountregister.style.backgroundColor = "transparent";
    emailcodelogin.style.backgroundColor = "#00a1d6";
    selfaccountlogin.style.backgroundColor = "transparent";
    selfaccountlogin.style.color = "#666";
}

selfaccountregister.onclick = function () {
    logincover.style.display = "block";
    loginmodal.style.height = "300px"
    hidesearchinput.style.display = "none";
    loginthrer.style.display = "none";
    newpasswordthere.style.display = "none";
    registerthere.style.display = "none";
    emailcodeloginthere.style.display = "none";
    selfaccountregisterthere.style.display = "block";
    selfaccountloginthere.style.display = "none";
    emailregister.style.color = "#666";
    emailpasswordlogin.style.color = "#666";
    changepassword.style.color = "#666";
    selfaccountregister.style.color = "white";
    selfaccountregister.style.backgroundColor = "transparent";
    emailpasswordlogin.style.backgroundColor = "transparent";
    emailregister.style.backgroundColor = "transparent";
    selfaccountregister.style.backgroundColor = "#00a1d6";
    emailcodelogin.style.backgroundColor = "transparent";
    selfaccountlogin.style.backgroundColor = "transparent";
    emailcodelogin.style.color = "#666";
    selfaccountlogin.style.color = "#666";
}

selfaccountlogin.onclick = function () {
    logincover.style.display = "block";
    loginmodal.style.height = "300px"
    hidesearchinput.style.display = "none";
    loginthrer.style.display = "none";
    newpasswordthere.style.display = "none";
    registerthere.style.display = "none";
    emailcodeloginthere.style.display = "none";
    selfaccountregisterthere.style.display = "none";
    selfaccountloginthere.style.display = "block";
    emailregister.style.color = "#666";
    emailpasswordlogin.style.color = "#666";
    changepassword.style.color = "#666";
    selfaccountregister.style.color = "#666";
    emailcodelogin.style.color = "#666";
    selfaccountlogin.style.color = "white";
    selfaccountlogin.style.backgroundColor = "#00a1d6";
    emailpasswordlogin.style.backgroundColor = "transparent";
    emailregister.style.backgroundColor = "transparent";
    selfaccountregister.style.backgroundColor = "transparent";
    emailcodelogin.style.backgroundColor = "transparent";
    changepassword.style.backgroundColor = "transparent";
}








/*获取验证码的定时器操作！！！！ */
var emailregisteremail = document.getElementById("emailregisteremail");
var emailregisterpassword = document.getElementById("emailregisterpassword");
var emailregisterrepassword = document.getElementById("emailregisterrepassword");
var emailregistercode = document.getElementById("emailregistercode");
var getyzm = document.getElementById("getyzm");
var bindemailgetyzm = document.getElementById("bindemailgetyzm");
/*获取验证码的定时器！*/
var countDownNumber = 60;
var countDownTimer;
function countDownFunction() {
    if (countDownNumber == 0) {
        getyzm.innerHTML = "重新发送";
        emailcodelogingetyzm.innerHTML = "重新发送";
        newpasswordgetyzm.innerHTML = "重新发送";
        bindemailgetyzm.innerHTML = "重新发送";
        loginemailgetyzm.innerHTML = "重新发送";
        bindemailgetyzm.innerHTML = "重新发送";
        $('#getyzm').removeAttr("disabled");
        $('#emailcodelogingetyzm').removeAttr("disabled");
        $('#loginemailgetyzm').removeAttr("disabled");
        $('#newpasswordgetyzm').removeAttr("disabled");
        countDownNumber = 60;
        clearInterval(countDownTimer);
       
    } else {    
        countDownNumber--;
        getyzm.innerHTML = countDownNumber + "s";
        emailcodelogingetyzm.innerHTML = countDownNumber + "s秒后重试";
        newpasswordgetyzm.innerHTML = countDownNumber + "s秒后重试";
        bindemailgetyzm.innerHTML = countDownNumber + "s秒后重试";
        loginemailgetyzm.innerHTML = countDownNumber + "s秒后重试";
        bindemailgetyzm.innerHTML = countDownNumber + "s秒后重试";
        $('#getyzm').attr("disabled", "true");
        $('#emailcodelogingetyzm').attr("disabled", "true");
        $('#loginemailgetyzm').attr("disabled", "true");
        $('#newpasswordgetyzm').attr("disabled", "true");
    }
}




getyzm.onclick = function () {
    hidesearchinput.style.display = "none";
    console.log(emailregisteremail.value)
    axios({
        url: '/sendEmail',
        method: 'post',
        params: {
            to: emailregisteremail.value,
        }
    })
        .then(function (data) {
            countDownTimer = setInterval(function () {
                countDownFunction();
            }, 1000);
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "获取验证码成功！";
            /*通过js设置这个按钮不可点击 */
            
            /*获取完邮箱验证码之后进行邮箱注册环节！！！ */
            var emailregisterbtn = document.getElementById("emailregisterbtn");



        })
        .catch(function (error) {
            console.log(error)
            console.log('失败')
        })

}



emailregisterbtn.onclick = function () {
    hidesearchinput.style.display = "none";
    axios({
        url: '/emailAddUser',
        method: 'put',
        params: {
            code: emailregistercode.value,
            email: emailregisteremail.value,
            passWord: emailregisterpassword.value,
            rePassWord: emailregisterrepassword.value,
        }
    })
        .then(function (data) {
            console.log("js中的data");
            console.log(data)
            window.location.reload()
        })
        .catch(function (error) {
            console.log(error)
            console.log('邮箱注册失败')
        })
}





/*邮箱验证码登录 */
var emailcodelogingetyzm = document.getElementById("emailcodelogingetyzm");
/*邮箱验证码登录 */
var emailcodeemail = document.getElementById("emailcodeemail");
var emailcodecode = document.getElementById("emailcodecode");
var emailcodebtn = document.getElementById("emailcodebtn");
emailcodelogingetyzm.onclick = function () {
    hidesearchinput.style.display = "none";
    console.log(emailcodeemail.value)
    axios({
        url: '/sendEmail',
        method: 'post',
        params: {
            to: emailcodeemail.value,
        }
    })
        .then(function (data) {
            console.log(data)
            countDownTimer = setInterval(function () {
                countDownFunction();
            }, 1000);
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "获取验证码成功";
            /*通过js设置这个按钮不可点击 */
          

            emailcodebtn.onclick = function () {
                axios({
                    url: '/emailLogin',
                    method: 'post',
                    params: {
                        code: emailcodecode.value,
                        email: emailcodeemail.value,
                    }
                })
                    .then(function (data) {
                        console.log(data)
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = data.data.message;
                    })
                    .catch(function (error) {
                        console.log(error)
                        console.log('邮箱验证码登录失败')
                    })
            }


        })
        .catch(function (error) {
            console.log(error)
            console.log('失败')
        })
}










/*登录更改密码的弹窗的消失 */
var closelogintc = document.querySelectorAll(".closelogintc");
console.log(closelogintc)
for (let i = 0; i < closelogintc.length; i++) {
    closelogintc[i].onclick = function () {
        hidesearchinput.style.display = "none";
        headimgHide.style.display = "none";
        logincover.style.display = "none";
        loginmodal.style.display = "none";
    }
}


/*登录  退出的操作！！！！ */
var tologin = document.getElementById("tologin");
tologin.onclick = function () {
    hidesearchinput.style.display = "none";
    headimgHide.style.display = "none";
    logincover.style.display = "block";
    loginmodal.style.display = "block";
}

/*开通vip进行切换新帐号的操作    实际上就是退出然后仍然显示登录vip的地方之后再显示登录的地方！！！ */
var changeqq = document.getElementById("changeqq");
changeqq.onclick = function () {
    hidesearchinput.style.display = "none";
    /*退出的操作！！！ */

    /*显示登录的弹窗 */
    cover.style.display = "none";
    modal.style.display = "none";


    logincover.style.display = "block";
    loginmodal.style.display = "block";
}


/*积分兑换 */
var godh = document.getElementById("godh");

godh.onclick = function () {
    if (userIdmessage.innerHTML == "") {
        $('.prompt').show().delay(1000).fadeOut();
        prompt[0].innerText = "尚未登录，请先登录";
    } else {
        hidesearchinput.style.display = "none";
        /*总积分 */
        var alljftwo = document.getElementById("alljftwo");
        alljftwo.innerHTML = alljf.innerHTML;
        containRightjfdh.style.display = "block";
        containRightsc.style.display = "none";
        containRightsz.style.display = "none";
        containRight.style.display = "none";
        containRightshangc.style.display = "none";
        containRightmessage.style.display = "none";
    }


}
/*点击出现积分规则 */
var integralRule = document.getElementById("integralRule");
integralRule.onclick = function () {
    hidesearchinput.style.display = "none";
    rulecover.style.display = "block";
    rulemodal.style.display = "block";
}
var closerule = document.getElementById("closerule");
closerule.onclick = function () {
    hidesearchinput.style.display = "none";
    rulecover.style.display = "none";
    rulemodal.style.display = "none";
}



/*积分兑换的商品！！！！！！积分兑换商品！！！！！！！的弹出内容！！！ */
var jpcontain = document.getElementsByClassName("jpcontain");
var jplast = document.getElementsByClassName("jplast");
console.log(jpcontain);
for (let i = 0; i < jpcontain.length; i++) {
    jpcontain[i].onclick = function () {
        hidesearchinput.style.display = "none";
        jpmodal.style.display = "block";
        jpcover.style.display = "block";
        //此时判断积分，看button内容应该为什么！！！
        var yy = alljftwo.innerHTML;
        var cc = jplast[i].innerHTML;
        console.log(yy);
        console.log(cc)
        console.log(parseInt(yy) > parseInt(cc))
        var btn = document.getElementsByClassName("btn")[0].querySelector("button");
        var viptype = document.getElementsByClassName(viptype);
        if (parseInt(yy) > parseInt(cc)) {
            // alert("1111")
            btn.innerHTML = "可以兑换"
            btn.addEventListener("click", function () {

            })
        } else {
            btn.innerHTML = "积分不足"
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "积分不足，请挑选其它兑换奖品";
            jpmodal.style.display = "none";
            jpcover.style.display = "none";

        }
        /*兑换奖品判断是否可以兑换 */



    }
}
var closejp = document.getElementById("closejp");
closejp.onclick = function () {
    hidesearchinput.style.display = "none";
    jpmodal.style.display = "none";
    jpcover.style.display = "none";
}



var exchangevip = document.getElementById("exchangevip");
var exchangevipcover = document.getElementById("exchangevipcover");
var exchangevipmodal = document.getElementById("exchangevipmodal");
exchangevip.onclick = function () {
    hidesearchinput.style.display = "none";
    /*兑换vip天数 */
    logincover.style.display = "block";
    exchangevipmodal.style.display = "block";
}

var closeexchangevip = document.getElementById("closeexchangevip");
closeexchangevip.onclick = function () {
    hidesearchinput.style.display = "none";
    logincover.style.display = "none";
    exchangevipmodal.style.display = "none";
}


/*去兑换按钮的执行以及判断 */
var goexchangebtn = document.getElementsByClassName("goexchangebtn");
var jfright = document.getElementsByClassName("jfright");
var jfvipid = document.getElementsByClassName("jfvipid");
console.log(jfright)
for (let i = 0; i < goexchangebtn.length; i++) {
    goexchangebtn[i].onclick = function () {
        var viptype = jfvipid[i].innerHTML
        hidesearchinput.style.display = "none";
        var q = jfright[i].innerHTML;
        console.log(q)
        var ql = q.split('积分')[0]
        console.log(ql)
        var my = alljftwo.innerHTML;
        console.log(my)
        if (ql > my) {
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "积分不足，不可以兑换";
        } else {
            /*积分充足，进行兑换！！！ */
            axios({
                url: '/updatePointToBuyVip',
                method: 'get',
                params: {
                    userId: userIdmessage.innerHTML,
                    vipId: viptype,/*vipid */
                }
            })
                .then(function (data) {
                    console.log(data)
                    $('.prompt').show().delay(1000).fadeOut();
                    prompt[0].innerText = "兑换成功";
                    window.location.reload()

                })
                .catch(function (error) {
                    console.log(error)
                    console.log('兑换vip天数接口失败')
                })

        }

    }
}




/*安全中心里面的修改手机  绑定邮箱 修改密码 账号注销四个操作的进行！ */
// var changetelephone = document.getElementById("changetelephone")
var getemail = document.getElementById("getemail")
var cpassword = document.getElementById("cpassword")
var accountdied = document.getElementById("accountdied")


var getemailcover = document.getElementById("getemailcover");
var getemailmodal = document.getElementById("getemailmodal");

/*修改手机号！！！ */
// changetelephone.ocnlick = function(){

// }
/*修改密码     分为两种 一种原密码 一种验证！！！*/
var cpasswordcover = document.getElementById("cpasswordcover");
var cpasswordmodal = document.getElementById("cpasswordmodal");
var closecpasswordmodal = document.getElementById("closecpasswordmodal");
var nocpassword = document.getElementById("nocpassword");
var yescpassword = document.getElementById("yescpassword");
cpassword.onclick = function () {
    hidesearchinput.style.display = "none";
    cpasswordcover.style.display = "block"
    cpasswordmodal.style.display = "block"
}

function cc() {
    cpasswordcover.style.display = "none";
    cpasswordmodal.style.display = "none";
}
closecpasswordmodal.onclick = function () {
    cc()
    hidesearchinput.style.display = "none";
}
nocpassword.onclick = function () {
    cc()
    hidesearchinput.style.display = "none";
}


var oneone = document.getElementsByClassName("hideone")[0];
var onetwo = document.getElementsByClassName("hideone")[1];
var onethree = document.getElementsByClassName("hideone")[2];
var onefour = document.getElementsByClassName("hideone")[3];
var loginemailgetyzm = document.getElementById("loginemailgetyzm");
var ones = document.getElementsByClassName("one");
var twos = document.getElementsByClassName("two");


var twoone = document.getElementsByClassName("hidetwo")[0];//邮箱
var twotwo = document.getElementsByClassName("hidetwo")[1];//验证码





yescpassword.onclick = function () {
    axios({
        url: '/updatePassWord',
        method: 'put',
        params: {
            account: oneone.value,
            newPassWord: onethree.value,
            oldPassWord: onetwo.value,
            rePassWord: onefour.value,
        }
    })
        .then(function (data) {
            console.log(data)
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "修改密码成功，请重新进行登录";
        })
        .catch(function (error) {
            console.log(error)
            console.log('根据原密码修改密码失败')
        })


}
loginemailgetyzm.onclick = function () {
    axios({
        url: '/sendEmail',
        method: 'post',
        params: {
            to: twoone.value,
        }
    })
        .then(function (data) {
            countDownTimer = setInterval(function () {
                countDownFunction();
            }, 1000);
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "获取验证码成功！";
           
            /*进行登录奥特曼 */
            yescpassword.onclick = function () {
                axios({
                    url: '/updatePasswordByEmail',
                    method: 'put',
                    params: {
                        code: twotwo.value,
                        email: twoone.value,
                        password: onethree.value,
                        rePassword: onefour.value,
                        userId: userIdmessage.innerHTML,
                    }
                })
                    .then(function (data) {
                        console.log(data)
                        window.location.href = "/myperson?4"
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = "修改密码成功,请重新进行登录";
                    })
                    .catch(function (error) {
                        console.log(error)
                        console.log('根据邮箱修改密码失败')
                    })


            }





        })
        .catch(function (error) {
            console.log(Error)
        })
}




var szforgetoldpassword = document.getElementById("szforgetoldpassword");
var szoldpassword = document.getElementById("szoldpassword");
szforgetoldpassword.onclick = function () {
    cpasswordmodal.style.height = "500px"
    hidesearchinput.style.display = "none";
    szoldpassword.style.display = "block";
    szforgetoldpassword.style.display = "none";
    for (let i = 0; i < ones.length; i++) {
        ones[0].style.display = "none";
        ones[1].style.display = "none";
    }
    for (let j = 0; j < twos.length; j++) {
        twos[j].style.display = "block";
    }

}
szoldpassword.onclick = function () {
    cpasswordmodal.style.height = "460px"
    hidesearchinput.style.display = "none";
    szoldpassword.style.display = "none";
    szforgetoldpassword.style.display = "block";
    for (let i = 0; i < ones.length; i++) {
        ones[i].style.display = "block";
    }
    for (let j = 0; j < twos.length; j++) {
        twos[j].style.display = "none";
    }
}
/*

/*绑定邮箱 */
getemail.onclick = function () {
    getemailcover.style.display = "block";
    getemailmodal.style.display = "block";
}
var closegetemailmodal = document.getElementById("closegetemailmodal");
var nogetemail = document.getElementById("nogetemail");
var yesgetemail = document.getElementById("yesgetemail");
function bb() {
    getemailcover.style.display = "none";
    getemailmodal.style.display = "none";
}
closegetemailmodal.onclick = function () {
    hidesearchinput.style.display = "none";
    bb()
}
nogetemail.onclick = function () {
    hidesearchinput.style.display = "none";
    bb()
}

var bindemailgetyzm = document.getElementById("bindemailgetyzm");
var bindemail = document.getElementById("bindemail");
bindemailgetyzm.onclick = function () {
    axios({
        url: '/sendEmail',
        method: 'post',
        params: {
            to: bindemail.value,
        }
    })
        .then(function (data) {
            countDownTimer = setInterval(function () {
                countDownFunction();
            }, 1000);
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "获取验证码成功！";
            /*通过js设置这个按钮不可点击 */
           
            yesgetemail.onclick = function () {
                /*点击确定执行绑定邮箱的操作！！！！ */
                axios({
                    url: '/updatesEmail',
                    method: 'put',
                    params: {
                        code: bindcode.value,
                        email: bindemail.value,
                        userId: userIdmessage.innerHTML,
                    }
                })
                    .then(function (data) {
                        console.log(data)
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = data.data.data.message;
                        window.location.href="/myperson?4"
                    })
                    .catch(function (error) {
                        console.log(error)
                        console.log('绑定邮箱失败')
                    })



                hidesearchinput.style.display = "none";
                bb()
            }


        })
        .catch(function (error) {
            console.log(Error)
        })
}

/*注销账号 */
var accountdiedcover = document.getElementById("accountdiedcover");
var accountdiedmodal = document.getElementById("accountdiedmodal");
accountdied.onclick = function () {
    hidesearchinput.style.display = "none";
    accountdiedcover.style.display = "block";
    accountdiedmodal.style.display = "block";
}
var closeaccountdiedmodal = document.getElementById("closeaccountdiedmodal");
var yesdied = document.getElementById("yesdied");
var nodied = document.getElementById("nodied");

function aa() {
    accountdiedcover.style.display = "none";
    accountdiedmodal.style.display = "none";
}
closeaccountdiedmodal.onclick = function () {
    hidesearchinput.style.display = "none";
    aa()
}
yesdied.onclick = function () {
    /*注销账号的操作！！！ */
    axios({
        url: '/deleteById',
        method: 'delete',
        params: {
            userId: userIdmessage.innerHTML,
        }
    })
        .then(function (data) {
            console.log(data)
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "注销成功";
            window.location.reload()

        })
        .catch(function (error) {
            console.log(error)
            console.log('注销失败')
        })
}
nodied.onclick = function () {
    hidesearchinput.style.display = "none";
    aa()
}






/*自定义账号注册 */
var selfaccountregisteraccount = document.getElementById("selfaccountregisteraccount");
var selfaccountregisterpassword = document.getElementById("selfaccountregisterpassword")
var selfaccountregisterbtn = document.getElementById("selfaccountregisterbtn")
selfaccountregisterbtn.onclick = function () {
    hidesearchinput.style.display = "none";
    axios({
        url: '/addUser',
        method: 'post',
        params: {
            account: selfaccountregisteraccount.value,
            password: selfaccountregisterpassword.value
        }
    })
        .then(function (data) {
            console.log(data)
            if (data.data.data.message == "成功") {
                window.location.reload();
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = "注册成功";
            } else {
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = data.data.data.message;

            }

        })
        .catch(function (error) {
            console.log(error)
            console.log('失败')
        })
}

/*邮箱密码登录*/
var emailpasswordbtn = document.getElementById("emailpasswordbtn");
var emailpasswordemail = document.getElementById("emailpasswordemail");
var emailpasswordpassword = document.getElementById("emailpasswordpassword");
emailpasswordbtn.onclick = function () {
    axios({
        url: '/loginByEmail',
        method: 'post',
        params: {
            email: emailpasswordemail.value,
            password: emailpasswordpassword.value
        }
    })
        .then(function (data) {
            console.log(data)
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "登录成功";
            window.location.reload();
            /*登录成功之后！！！！ */
            headimgHide.style.display = "none";
            logincover.style.display = "none";
            loginmodal.style.display = "none";
        })
        .catch(function (error) {
            console.log(error)
        })
}





/*收藏夹处！！！！ */
if (userIdmessage.innerHTML !== "") {
    /*登录之后遍历所有的收藏夹信息！！！ */
    var userallscj = document.getElementById("userallscj");
    axios({
        url: '/findAllCollectionFolders',
        method: 'get',
        params: {
            userId: userIdmessage.innerHTML,
        }
    })
        .then(function (data) {
            console.log(data)
            console.log(data.data.data.object)
            console.log(data.data.data.object.length)
            for (let i = 0; i < data.data.data.object.length; i++) {
                console.log(data.data.data.object[i].collectionFolderContent)
                userallscj.innerHTML += '<li class="scjliebiao">' +
                    `<span style="position: relative;top: 12px;">` + data.data.data.object[i].collectionFoldersName + `</span>` + //收藏夹名字
                    `<span style="position: relative;top: 12px;display:none;">` + data.data.data.object[i].collectionFolderContent + `</span>` +//收藏夹简介
                    `<span style="position: relative;top: 12px;display:none;">` + data.data.data.object[i].collectionFolderSrc + `</span>` +//收藏夹图片
                    `<span style="position: relative;top: 12px;display:none;">` + data.data.data.object[i].collectionFoldersId + `</span>`//收藏夹id
                    + '</li>'
            }



            /*新建新的收藏夹 */
            var addscj = document.getElementById("addscj");
            var addscjcover = document.getElementById("addscjcover");
            var addscjmodal = document.getElementById("addscjmodal");
            addscj.onclick = function () {
                hidesearchinput.style.display = "none";
                addscjcover.style.display = "block";
                addscjmodal.style.display = "block";
            }
            var addscjimg = document.getElementById("addscjimg")
            addscjimg.onclick = function () {
                hidesearchinput.style.display = "none";
                addscjcover.style.display = "block";
                addscjmodal.style.display = "block";
            }

            var closeaddscj = document.getElementById("closeaddscj");
            closeaddscj.onclick = function () {
                hidesearchinput.style.display = "none";
                addscjcover.style.display = "none";
                addscjmodal.style.display = "none";
            }

            var scjintroduction = document.getElementById("scjintroduction");
            /*遍历所有的收藏集之后进行往右侧进行点击遍历！！！！！ */
            var userallscjlis = document.getElementById("userallscj").querySelectorAll(".scjliebiao");
            for (let i = 0; i < userallscjlis.length; i++) {
                userallscjlis[i].onclick = function () {
                    var sccenter = document.getElementById("sccenter");
                    sccenter.style.display = "none";
                    scright.style.display = "block";
                    /*变色 */
                    for (let i = 0; i < userallscjlis.length; i++) {
                        userallscjlis[i].style.backgroundColor = "";
                        userallscjlis[i].style.color = "";
                    }
                    userallscjlis[i].style.backgroundColor = "#00a1d6";
                    userallscjlis[i].style.color = "white";
                    var scjname = document.getElementById("scjname");
                    var scjways = document.getElementById("scjways");
                    var scjheadimg = document.getElementById("scjheadimg");
                    var userallscjlisspans = userallscjlis[i].querySelectorAll("span")
                    for (var j = 0; j < userallscjlisspans.length; j++) {
                        scjname.innerHTML = "收藏夹名称:" + userallscjlisspans[0].innerHTML;
                        scjways.innerHTML = userallscjlisspans[3].innerHTML;
                        scjintroduction.innerHTML = "收藏夹简介:" + userallscjlisspans[1].innerHTML;
                        // if (userallscjlisspans[2].innerHTML == "未上传") {
                        //     scjheadimg.src = "../../publics/front-stage/img/headimg.gif"
                        // } else {
                            scjheadimg.src = `${userallscjlisspans[2].innerHTML}`;
                        // }
                    }



                }


                   
            }



        })


        
        .catch(function (error) {
            console.log(error)
            console.log('登录之后遍历所有的收藏夹信息失败！！！')
        })
    








    /*全部遍历之后，进行编辑收藏夹基本信息，删除，编辑收藏夹封面三种操作！！！ */
    /*根据收藏夹id查找收藏夹的信息进行遍历上去，以便于后面收藏夹的信息更改 */
    var changescjshow = document.getElementById("changescjshow");
    var changescjcover = document.getElementById("changescjcover");
    var changescjmodal = document.getElementById("changescjmodal");
    changescjshow.onclick = function () {
        var editmessagescjnickname = document.getElementById("editmessagescjnickname");
        var editmessagescjcontent = document.getElementById("editmessagescjcontent");
        var collectionFoldersId = document.getElementById("collectionFoldersId");

        hidesearchinput.style.display = "none";
        changescjcover.style.display = "block";
        changescjmodal.style.display = "block";
        console.log(scjways.innerHTML)
        axios({
            url: '/findCollectionFoldersById',
            method: 'get',
            params: {
                collectionFoldersId: scjways.innerHTML
            }
        })
            .then(function (data) {
                console.log(data)
                console.log(data.data.data.object)
                if (data.data.data.object.collectionFolderContent == "未填写") {
                    editmessagescjcontent.placeholder = "未填写"
                } else {
                    editmessagescjcontent.value = data.data.data.object.collectionFolderContent;
                }
                editmessagescjnickname.value = data.data.data.object.collectionFoldersName;
                collectionFoldersId.value = data.data.data.object.collectionFoldersId;
            })
            .catch(function (error) {
                console.log(error)
                console.log('获取收藏夹信息失败')
            })



        var nochangescjmessagebtn = document.getElementById("nochangescjmessagebtn")
        nochangescjmessagebtn.onclick = function () {
            changescjcover.style.display = "none";
            changescjmodal.style.display = "none";
            /*其实应该刷新页面 */
        }
        var yeschangescjmessage = document.getElementById("yeschangescjmessage");
        yeschangescjmessage.onclick = function () {
            axios({
                url: '/updateCollectionFolder',
                method: 'put',
                params: {
                    collectionFolderContent: editmessagescjcontent.value,
                    collectionFoldersId: collectionFoldersId.value,
                    collectionFoldersName: editmessagescjnickname.value,
                }
            })
                .then(function (data) {
                    $('.prompt').show().delay(1000).fadeOut();
                    prompt[0].innerText = "修改收藏夹的基本信息成功";
                    changescjcover.style.display = "none";
                    changescjmodal.style.display = "none";
                    window.location.href="/myperson?3"
                })
                .catch(function (error) {
                    console.log(error)
                    console.log('修改收藏夹的基本信息失败')
                })

        }



    }

    /*删除收藏夹！！！！！！ */
    var cancelonescj = document.getElementById("cancelonescj");
    cancelonescj.onclick = function () {
        hidesearchinput.style.display = "none";
        axios({
            url: '/deleteCollectionFolders?',
            method: 'DELETE',
            params: {
                collectionFoldersId: scjways.innerHTML,
            }
        })
            .then(function (data) {
                console.log(data)
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = "删除收藏夹成功";
                window.location.href = "/myperson?3"
                /*此处进行重新刷新页面 */
            })
            .catch(function (error) {
                console.log(error)
                console.log('删除收藏夹失败')
            })

    }
    /*修改视频封面 */
    var changescjfm = document.getElementById("changescjfm");
    changescjfm.onclick = function () {
        hidesearchinput.style.display = "none";
        changescjcover.style.display = "block";
        changescjfmmodal.style.display = "block";
        var collectionFoldersfmId = document.getElementById("collectionFoldersfmId");
        collectionFoldersfmId.value = scjways.innerHTML;
        var yeschangescjfmbtn = document.getElementById("yeschangescjfmbtn");
        yeschangescjfmbtn.onclick = function () {
            window.location.href = "/myperson?3"
        }



    }
    var nochangescjfmbtn = document.getElementById("nochangescjfmbtn");
    nochangescjfmbtn.onclick = function () {
        hidesearchinput.style.display = "none";
        changescjcover.style.display = "none";
        changescjfmmodal.style.display = "none";
    }


    /*结束 */




}


/*进行保存按钮的操作 */
/*首先获取哪一个被选中 */
newsex.onclick = function () {


    hidesearchinput.style.display = "none";
    /*点击保存！！！ */
    // sex.value = oldsex;
    allsex.style.display = "none";
    newsex.style.display = "none";
    closesex.style.display = "none";
    nowsex.style.display = "block";
    editsex.style.display = "block";

    var radionum = document.getElementById("allsex").querySelectorAll("input");
    console.log(radionum)
    for (var i = 0; i < radionum.length; i++) {
        if (radionum[i].checked) {
            console.log(radionum[i].value)
            axios({
                url: '/updateUserSex',
                method: 'put',
                params: {
                    sex: radionum[i].value,/*vipid */
                    userId: userIdmessage.innerHTML,/*用户id */
                }
            })
                .then(function (data) {
                    console.log(data)
                    axios({
                        url: '/findUserById',
                        method: 'get',
                        params: {
                            userId: userIdmessage.innerHTML,
                        }
                    })
                        .then(function (data) {
                            console.log(data.data.data.object)
                            console.log("获取用户个人信息成功")
                                navchangeimg.src = data.data.data.object.src
                                topheadimg.src = data.data.data.object.src
                                mymessageheadimg.src = data.data.data.object.src
                                vipviewheadimg.src = data.data.data.object.src
                            console.log(data.data.data.object.nickname.length)
                            var vipnickname = document.getElementById("vipnickname");
                            var iflogin = document.getElementById("iflogin")
                            if (data.data.data.object.nickname.length > 5) {
                                var lastnickname = data.data.data.object.nickname.replace(/^\s*|\s*$/g, "").substring(0, 5) + "...";
                                vipnickname.innerHTML = lastnickname
                                topname.innerHTML = data.data.data.object.nickname
                                leftnickname.innerHTML = lastnickname
                                console.log(leftnickname.innerHTML)
                                iflogin.innerHTML = lastnickname
                                var nowname = document.getElementById("nowname")
                                nowname.value = data.data.data.object.nickname

                            } else {
                                vipnickname.innerHTML = data.data.data.object.nickname
                                topname.innerHTML = data.data.data.object.nickname
                                leftnickname.innerHTML = data.data.data.object.nickname
                                console.log(leftnickname.innerHTML)
                                iflogin.innerHTML = data.data.data.object.nickname
                                var nowname = document.getElementById("nowname")
                                nowname.value = data.data.data.object.nickname
                            }


                            /*性别 */
                            var nowsex = document.getElementById("nowsex").querySelector("input")
                            nowsex.value = data.data.data.object.sex

                            /*是否是视频号 */
                            // videoNumber   0不是视频号   1是视频号
                            var ifsphuser = document.getElementById("ifsphuser");
                            ifsphuser.innerHTML = data.data.data.object.videoNumber;
                            if (ifsphuser.innerHTML == "0") {
                                console.log("不是视频号")
                            } else {
                                console.log("是视频号")
                            }




                            /*性别的遍历 */
                            nowsex.value = data.data.data.object.sex
                            /*关注与粉丝总数的遍历 */
                            /*简介的遍历 */
                            nowjj.value = data.data.data.object.introduction
                            /*vip等级以及vip天数的遍历 */

                            viptype.innerHTML = data.data.data.object.vip;

                            var getemail = document.getElementById("getemail");
                            /*邮箱的遍历 */
                            var ifbindemail = document.getElementById("ifbindemail");/*是否绑定邮箱 */
                            if (data.data.data.object.email == "") {
                                ifbindemail.innerHTML = "尚未绑定邮箱"
                                getemail.innerHTML = "绑定邮箱"
                            } else {
                                ifbindemail.innerHTML = data.data.data.object.email
                                getemail.innerHTML = "更改邮箱"
                            }
                            var loginpasswordinput = document.getElementById("loginpasswordinput");/*用户密码的遍历 */
                            loginpasswordinput.innerHTML = "**********"

                            /*判断是否是会员 */
                            var tovip = document.getElementById("tovip");
                            var novipimg = document.getElementById("novipimg");
                            var havevipimg = document.getElementById("havevipimg");
                            var wordone = document.getElementById("wordone");
                            var wordtwo = document.getElementById("wordtwo");
                            var loginuserid = userIdmessage.innerHTML;
                            var szviptype = document.getElementById("szviptype");
                            var nowvip = document.getElementById("nowvip");
                            // alert(viptype.innerHTML)
                            if (viptype.innerHTML == "0") {
                                console.log("普通用户")
                                tovip.innerHTML = "开通会员"
                                novipimg.style.display = "block";
                                havevipimg.style.display = "none";
                                wordtwo.style.display = "block"
                                wordone.style.display = "none"
                                szviptype.innerHTML = "您尚未开通任何会员"
                                nowvip.innerHTML = "立即开通vip"
                            } else {
                                console.log("vip用户")
                                tovip.innerHTML = "续费会员"
                                novipimg.style.display = "none";
                                havevipimg.style.display = "block";
                                wordone.style.display = "block"
                                wordtwo.style.display = "none"
                                szviptype.innerHTML = "您已开通黄金vip"
                                szviptype.style.color = "#e3b54c"
                                nowvip.innerHTML = "立即续费vip"
                            }






                        })
                        .catch(function (error) {
                            console.log(error)
                            console.log('失败')
                        })

                })
                .catch(function (error) {
                    console.log(error)
                    console.log('失败')
                })

        }




    }
    /*修改个人基本信息处！！！！ */




}

/*创作中心上传电视剧悬浮动图！！！ */
function adddsjvidegif() {

    function fileToBase64six(a) {
        var txt = a.files[0];
        formData = new FormData()
        formData.append('img[]', txt);
        var src = window.URL.createObjectURL(txt);
        var dsjvideogif = document.getElementById("dsjvideogif");
        dsjvideogif.src = `${src}`
    }
    var dsjgiffile = document.getElementsByClassName("dsjgiffile")[0]
    fileToBase64six(dsjgiffile)


    // var fileone = document.getElementsByClassName("dsjgiffile")[0]
    console.log(dsjgiffile.files[0].name)
    dsjgifvideoimg.style.display = "none";
    // var dsjvideogif = document.getElementById("dsjvideogif");
    dsjvideogif.style.display = "block";
    dsjgiffile.style.display = "none";
    // dsjvideogif.src = "../../publics/front-stage/img/" + fileone.files[0].name
}
/*创作中心上传电视剧封面 */
function adddsjvidephoto() {

    function fileToBase64six(a) {
        var txt = a.files[0];
        formData = new FormData()
        formData.append('img[]', txt);
        var src = window.URL.createObjectURL(txt);
        var dsjvideophoto = document.getElementById("dsjvideophoto");
        dsjvideophoto.src = `${src}`
    }
    var fileone = document.getElementsByClassName("dsjphotofile")[0]
    fileToBase64six(fileone)


    var dsjphotovideoimg = document.getElementById("dsjphotovideoimg");
    
    console.log(fileone.files[0].name)
    dsjphotovideoimg.style.display = "none";
    // var dsjvideophoto= document.getElementById("dsjvideophoto");
    dsjvideophoto.style.display = "block";
    fileone.style.display = "none";
    // dsjvideophoto.src = "../../publics/front-stage/img/" + fileone.files[0].name
}



/*创作中心进行上传视频的预览 */
function addvideimg() {
    // 一个文件上传的回调 
    // <input type="file" οnchange="onChange(event)">
    // function onChange(event) {
    //     var file = event.files[0];
    //     // console.log(file)
    //     // console.log("8885555")
    //     var reader = new FileReader();
    //     reader.onload = function (event) {
    //         // 文件里的文本会在这里被打印出来
    //         console.log(event.result)
    //     };
    //     var aa = reader.readAsDataURL(file);
    //    console.log(aa)
    // }



    var fileone = document.getElementsByClassName("file")[0]
    // onChange(fileone)
    var videoimg = document.getElementById("videoimg");
    console.log(fileone.files[0].name)
    videoimg.style.display = "none";
    var hh = document.getElementById("hh")
    hh.style.display = "block";
    fileone.style.display = "none";
    hh.src = "../../publics/front-stage/img/" + fileone.files[0].name
}
var hidevidefm = document.getElementById("hidevidefm");
function addvidefmimg() {
    /*将本地图片转化成本地预览 */
    //将file转为base64
    function fileToBase64(a) {
        var txt = a.files[0];
        formData = new FormData()
        formData.append('img[]', txt);
        var src = window.URL.createObjectURL(txt);
        var hidevidefm = document.getElementById("hidevidefm");
        hidevidefm.src = `${src}`
    }
    var spfm = document.getElementById("spfm");
    fileToBase64(spfm)


    var videoimgfm = document.getElementById("videoimgfm");
    var spfm = document.getElementById("spfm");
    console.log(spfm.files[0].name)
    videoimgfm.style.display = "none";
    // var hidevidefm = document.getElementById("hidevidefm");
    hidevidefm.style.display = "block";
    spfm.style.display = "none";
    // hidevidefm.src = "../../publics/front-stage/img/" + spfm.files[0].name
}
/*上传视频gif悬浮图片 */
function addvidegiffmimg() {

    function fileToBase64two(a) {
        var txt = a.files[0];
        formData = new FormData()
        formData.append('img[]', txt);
        var src = window.URL.createObjectURL(txt);
        var hidegifvidefm = document.getElementById("hidegifvidefm");
        hidegifvidefm.src = `${src}`
    }
    var spgiffm = document.getElementById("spgiffm");
    fileToBase64two(spgiffm)


    var videogifimgfm = document.getElementById("videogifimgfm");
    console.log(spgiffm.files[0].name)
    videogifimgfm.style.display = "none";
    // var hidegifvidefm = document.getElementById("hidegifvidefm");
    hidegifvidefm.style.display = "block";
    spgiffm.style.display = "none";
    // hidegifvidefm.src = "../../publics/front-stage/img/" + spgiffm.files[0].name
}
/*修改收藏夹封面的img */
var addscjimgfmfile = document.getElementById("addscjimgfmfile");
var addscjimgnewimg = document.getElementById("addscjimgnewimg");
var changehead = document.getElementById("changehead");
// function addscjimgfmimg() {
    // var addscjfmimgbtn = document.getElementById("addscjfmimgbtn");
    // console.log(addscjimgfmfile.files[0].name)
    // addscjfmimgbtn.style.display = "none";
    // addscjimgnewimg.style.display = "block";
    // addscjimgfmfile.style.display = "none";
    // addscjimgnewimg.src = "../../publics/front-stage/img/" + addscjimgfmfile.files[0].name
// }



function addheadimgimg() {

    function fileToBase64three(a) {
        var txt = a.files[0];
        formData = new FormData()
        formData.append('img[]', txt);
        var src = window.URL.createObjectURL(txt);
        var hideheadimgsc = document.getElementById("hideheadimgsc");
        hideheadimgsc.src = `${src}`
    }
    var addheadimgfile = document.getElementById("addheadimgfile");
    fileToBase64three(addheadimgfile)


    var scheadimgimg = document.getElementById("scheadimgimg");
    
    console.log(addheadimgfile.files[0].name)
    scheadimgimg.style.display = "none";
    
    hideheadimgsc.style.display = "block";
    addheadimgfile.style.display = "none";
    // hideheadimgsc.src = "../../publics/front-stage/img/" + addheadimgfile.files[0].name
}

/*修改视频封面 */
function changevideoallimg() {


    function fileToBase64four(a) {
        var txt = a.files[0];
        formData = new FormData()
        formData.append('img[]', txt);
        var src = window.URL.createObjectURL(txt);
        var lastchangevideoimg = document.getElementById("lastchangevideoimg");
        lastchangevideoimg.src = `${src}`
    }
    var changevideoinput = document.getElementById("changevideoinput");
    fileToBase64four(changevideoinput)


    var changevideofirstimg = document.getElementById("changevideofirstimg");
    // var changevideoinput = document.getElementById("changevideoinput");
    console.log(changevideoinput.files[0].name)
    changevideofirstimg.style.display = "none";
    // var lastchangevideoimg = document.getElementById("lastchangevideoimg");
    lastchangevideoimg.style.display = "block";
    changevideoinput.style.display = "none";
    // lastchangevideoimg.src = "../../publics/front-stage/img/" + changevideoinput.files[0].name
}
/*修改视频gif动图 */
function changevideoallimgtwo() {

    function fileToBase64five(a) {
        var txt = a.files[0];
        formData = new FormData()
        formData.append('img[]', txt);
        var src = window.URL.createObjectURL(txt);
        var lastchangevideoimgtwo = document.getElementById("lastchangevideoimgtwo");
        lastchangevideoimgtwo.src = `${src}`
    }
    var changevideoinputtwo = document.getElementById("changevideoinputtwo");
    fileToBase64five(changevideoinputtwo)


    var changevideofirstimgtwo = document.getElementById("changevideofirstimgtwo");
    // var changevideoinputtwo = document.getElementById("changevideoinputtwo");
    console.log(changevideoinputtwo.files[0].name)
    changevideofirstimgtwo.style.display = "none";
    // var lastchangevideoimgtwo = document.getElementById("lastchangevideoimgtwo");
    lastchangevideoimgtwo.style.display = "block";
    changevideoinputtwo.style.display = "none";
    // lastchangevideoimgtwo.src = "../../publics/front-stage/img/" + changevideoinputtwo.files[0].name
}






/*创作中心的放弃上传视频 */
var fq = document.getElementById("fq");
var fqvideocover = document.getElementById("fqvideocover")
var fqvideomodal = document.getElementById("fqvideomodal")
fq.onclick = function () {
    hidesearchinput.style.display = "none";
    fqvideocover.style.display = "block";
    fqvideomodal.style.display = "block";
}
function closefqvideobtn() {
    fqvideocover.style.display = "none";
    fqvideomodal.style.display = "none";
}
function yesfqvideobtn() {

}
var closefqvideo = document.getElementById("closefqvideo");
closefqvideo.onclick = function () {
    hidesearchinput.style.display = "none";
    fqvideocover.style.display = "none";
    fqvideomodal.style.display = "none";
}




/*新建收藏夹！！！！ */
var addscjbtn = document.getElementById("addscjbtn");
var addscjname = document.getElementById("addscjname");

addscjbtn.onclick = function () {
    hidesearchinput.style.display = "none";
    console.log(addscjname);
    var aa = addscjname.value;
    console.log(aa)
    axios({
        url: '/addCollectionFolder?',
        method: 'post',
        params: {
            collectionFoldersName: addscjname.value,
            userId: userIdmessage.innerHTML
        }
    })
        .then(function (data) {
            console.log(data)
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "新建收藏夹成功";
            window.location.href = "/myperson?3"
            addscjmodal.style.display = "none";
            addscjcover.style.display = "none";
            /*此处跳转至收藏夹处 */
        })
        .catch(function (error) {
            console.log(error)
            console.log('新建收藏夹夹失败')
        })
}














/*鼠标触碰收藏地方出现更多的按钮 */
// var hidemoreeditbtn = document.getElementsByClassName("hidemoreeditbtn")[0];
// hidemoreeditbtn.onmouseover = function(){
//     hidemoreeditbtn.style.display="block"
// }


/*遍历视频的所有类型 */
var changesptype = document.getElementById("changesptype");
axios({
    url: '/s',
    method: 'get',
})
    .then(function (data) {
        console.log(data)
        console.log("hahahhahahhahahahhahahahha")
        var spalltype = data.data.data.record


        for (let i = 0; i < spalltype; i++) {
            /*遍历视频的所有类型成功之后进行给创作中心选择视频类型上进行传送 */
            var sptype = document.getElementById("sptype");
            var spdsjtype = document.getElementById("spdsjtype");
            var changesptype = document.getElementById("changesptype");
            sptype.innerHTML += `<option value='${data.data.data.data[i]}'>` + data.data.data.data[i] + `</option>`
            changesptype.innerHTML += `<option value='${data.data.data.data[i]}'>` + data.data.data.data[i] + `</option>`
            spdsjtype.innerHTML += `<option value='${data.data.data.data[i]}'>` + data.data.data.data[i] + `</option>`
        }

    })
    .catch(function (error) {
        console.log(error)
        console.log('遍历视频的所有类型失败')
    })



/*遍历视频的所有资费类型 */
axios({
    url: '/whetherFree',
    method: 'get',
})
    .then(function (data) {
        var spalltype = data.data.data.data.length
        for (let i = 0; i < spalltype; i++) {
            /*遍历视频的所有资费类型成功之后进行给创作中心选择视频类型上进行传送 */
            var spifmoneyname = document.getElementById("spifmoneyname");
            spifmoneyname.innerHTML += `<option>` + data.data.data.data[i] + `</option>`

            var changespffways = document.getElementById("changespffways");
            changespffways.innerHTML += `<option>` + data.data.data.data[i] + `</option>`
        }

    })
    .catch(function (error) {
        console.log(error)
        console.log('遍历视频的所有资费类型失败')
    })

/*遍历视频的所有年份类型 */
axios({
    url: '/yearTags',
    method: 'get',
})
    .then(function (data) {
        var spalltype = data.data.data.data.length
        console.log("遍历视频的所有年份类型成功！！")
        for (let i = 0; i < spalltype; i++) {
            /*遍历视频的所有年份类型成功之后进行给创作中心选择视频类型上进行传送 */
            var spyearname = document.getElementById("spyearname");
            spyearname.innerHTML += `<option>` + data.data.data.data[i] + `</option>`

            var changespyears = document.getElementById("changespyears");
            changespyears.innerHTML += `<option>` + data.data.data.data[i] + `</option>`
        }

    })
    .catch(function (error) {
        console.log(error)
        console.log('遍历视频的所有年份类型失败')
    })

/*遍历视频的所有地区类型 */
axios({
    url: '/areaTags',
    method: 'get',
})
    .then(function (data) {
        var spalltype = data.data.data.data.length
        console.log("遍历视频的所有地区类型成功！！")
        for (let i = 0; i < spalltype; i++) {
            /*遍历视频的所有年份类型成功之后进行给创作中心选择视频类型上进行传送 */
            var splangaugename = document.getElementById("splangaugename");
            splangaugename.innerHTML += `<option>` + data.data.data.data[i] + `</option>`

            var changespdq = document.getElementById("changespdq");
            changespdq.innerHTML += `<option>` + data.data.data.data[i] + `</option>`
        }

    })
    .catch(function (error) {
        console.log(error)
        console.log('遍历视频的所有地区类型失败')
    })


var searchinputlis = document.getElementById("searchinputlis");
/*返回热度前八 */
axios({
    url: '/tenHotVideo',
    method: 'get',
})
    .then(function (data) {
        /*遍历出来之后将热度前十的弄到搜索框处 */
        for (let i = 0; i < data.data.data.data.length; i++) {
            searchinputlis.innerHTML +=
                `<li>` +
                `<button class="btntop">` + (i + 1) + `</button>` +
                `<span>` + data.data.data.data[i] + `</span>` +
                `</li>`
        }
    })
    .catch(function (error) {
        console.log(error)
        console.log('获取热度前八失败')
    })




/*鼠标集中input出现下拉栏！！！ */
var searchinput = document.getElementById("searchinput");
searchinput.onclick = function (e) {
    var btntops = document.getElementsByClassName("btntop");
    for (let i = 0; i < 3; i++) {
        btntops[i].style.backgroundImage = "linear-gradient(233deg,#00d099,#00cc36)"
        btntops[i].style.color = "white"
    }


    hidesearchinput.style.display = "block";
    headimgHide.style.display = "none";
    /*鼠标点击内容，内容上到input里面 */
    var hidesearchinputlis = document.getElementById("searchinputlis").querySelectorAll("li")
    var hidesearchinputspans = document.getElementById("searchinputlis").querySelectorAll("span")
    for (let j = 0; j < hidesearchinputlis.length; j++) {
        hidesearchinputlis[j].onclick = function () {
            searchinput.value = hidesearchinputspans[j].innerHTML;
            console.log(hidesearchinputspans[j].innerHTML)
            hidesearchinput.style.display = "none";
           
        }
    }

    e = e || event; stopFunc(e);
}

document.onclick = function (e) {
    hidesearchinput.style.display = "none"
}




function stopFunc(e) {
    e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
}



/*点击关注出现关注列表！！！！！ */
var gz = document.getElementById("gz");
var hidegzcover = document.getElementById("hidegzcover")
var hidegzmodal = document.getElementById("hidegzmodal")

gz.onclick = function () {
    if (userIdmessage.innerHTML == "") {
        $('.prompt').show().delay(1000).fadeOut();
        prompt[0].innerText = "尚未登录，不可查看关注列表";
    } else {
        if (gz.innerHTML == "关注:0") {
            hidegzmodal.style.width = "20%";
            hidegzmodal.style.top = "34%";
            hidegzmodal.style.left = "40%";
            hidegzmodal.style.height = "300px";
            allgzlul.style.display = "none";
            nogz.style.display = "block";
            hidegzcover.style.display = "block";
            hidegzmodal.style.display = "block";
            hidegzmodal.style.overflowY = "hidden"
        } else {

            hidegzmodal.style.overflowY = "scroll"

            /*关注者的简介 */
            var gzmypersonintroduction = document.getElementsByClassName("gzmypersonintroduction");
            for (let i = 0; i < gzmypersonintroduction.length; i++) {
                // console.log(gzmypersonintroduction[i].innerHTML == "简介:")
                if (gzmypersonintroduction[i].innerHTML == "简介:") {
                    gzmypersonintroduction[i].innerHTML = "简介：暂无简介"
                }
            }

            
            hidegzcover.style.display = "block";
            hidegzmodal.style.display = "block";
            var fsgogzid = document.getElementsByClassName("fsgogzid");
            for (let j = 0; j < gzclosegz.length; j++) {
                gzclosegz[j].onclick = function () {
                    var noticedIdcontain = fsgogzid[j].innerHTML.replace(/^\s*|\s*$/g, "")
                    /*点击取关进行取消关注的操作！！！ */
                    axios({
                        url: '/CancelAttentionByUserIdAndNoticedId',
                        method: 'post',
                        params: {
                            noticedId: noticedIdcontain,//被关注者id
                            userId: userIdmessage.innerHTML,
                        }
                    })
                        .then(function (data) {
                            console.log(data)
                            console.log("取关成功")

                            window.location.reload()

                        })
                        .catch(function (error) {
                            console.log(error)
                            console.log('取关失败')
                        })

                }
            }







        }

    }

}
/*点击粉丝出现粉丝列表！！！！！ */
var fs = document.getElementById("fs");
var hidefsmodal = document.getElementById("hidefsmodal")
var nofans = document.getElementById("nofans")
fs.onclick = function () {
    /*首先判断是否登录，如果没有登陆则不可以点击，并且提示！！！！！ */
    if (userIdmessage.innerHTML == "") {
        $('.prompt').show().delay(1000).fadeOut();
        prompt[0].innerText = "尚未登录，不可查看粉丝列表";
    } else {
        if (fs.innerHTML == "粉丝:0") {
            hidefsmodal.style.width = "20%";
            hidefsmodal.style.top = "34%";
            hidefsmodal.style.left = "40%";
            hidefsmodal.style.height = "300px";
            hidefsmodal.style.overflowY="hidden"

            nofans.style.display = "block";
            hidegzcover.style.display = "block";
            hidefsmodal.style.display = "block";
        } else {
            hidefsmodal.style.overflowY = "scroll"

            /*关注者的简介 */
            var fsmypersonintroduction = document.getElementsByClassName("fsmypersonintroduction");
            for (let i = 0; i < fsmypersonintroduction.length; i++) {
                // console.log(gzmypersonintroduction[i].innerHTML == "简介:")
                if (fsmypersonintroduction[i].innerHTML == "简介:") {
                    fsmypersonintroduction[i].innerHTML = "简介：暂无简介"
                }
            }


            nofans.style.display = "none";
            hidegzcover.style.display = "block";
            hidefsmodal.style.display = "block";
            /*点开粉丝列表之后进行取关的操作！！！ */
            var fsid = document.getElementsByClassName("fsid");
            console.log(closegz)
            for (let j = 0; j < closegz.length; j++) {
                closegz[j].onclick = function () {
                    var noticedIdcontain = fsid[j].innerHTML.replace(/^\s*|\s*$/g, "")
                    /*点击取关进行取消关注的操作！！！ */
                    axios({
                        url: '/CancelAttentionByUserIdAndNoticedId',
                        method: 'post',
                        params: {
                            noticedId: noticedIdcontain,//被关注者id
                            userId: userIdmessage.innerHTML,
                        }
                    })
                        .then(function (data) {
                            $('.prompt').show().delay(1000).fadeOut();
                            prompt[0].innerText = "取关成功";
                            window.location.reload()

                        })
                        .catch(function (error) {
                            console.log(error)
                            console.log('取关失败')
                        })

                }
            }


        }

    }

}
var closeallfs = document.getElementsByClassName("closeallfs")[0];
closeallfs.onclick = function () {
    hidegzcover.style.display = "none";
    hidefsmodal.style.display = "none";
}
var allgzlul = document.getElementById("allgzlul");
var closeallgz = document.getElementsByClassName("closeallgz")[0];
closeallgz.onclick = function () {
    hidegzcover.style.display = "none";
    hidegzmodal.style.display = "none";
}




/*去回复 */
var toreply = document.getElementById("toreply");
var replydiv = document.getElementById("replydiv");
var noreply = document.getElementById("noreply");
var yesreply = document.getElementById("yesreply");
toreply.onclick = function () {
    /*显示回复框 */
    replydiv.style.display = "block"
}
noreply.onclick = function () {
    /*显示回复框 */
    replydiv.style.display = "none"
}
yesreply.onclick = function () {
    /*显示回复框 */
    replydiv.style.display = "none"
}



/*关注别人！！！ */
var fsgogzbtn = document.getElementsByClassName("fsgogzbtn")
var fsid = document.getElementsByClassName("fsid");
var nums = fsgogzbtn.length
for (let i = 0; i < nums; i++) {
    fsgogzbtn[i].onclick = function () {
        console.log(fsid[i].innerHTML.replace(/^\s*|\s*$/g, ""))
        var noticeid = fsid[i].innerHTML.replace(/^\s*|\s*$/g, "")
        axios({
            url: '/attentionOtherUser',
            method: 'put',
            params: {
                noticedId: noticeid,
                userId: userIdmessage.innerHTML,

            }
        })
            .then(function (data) {
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = "成功关注此用户";
                window.location.reload();
            })
            .catch(function (error) {
                console.log(error)
                console.log('关注此用户失败')
            })


    }

}



/*根据邮箱进行更改密码 */
var newpasswordemail = document.getElementById("newpasswordemail");
var newpasswordepassword = document.getElementById("newpasswordepassword");
var newpassworderepassword = document.getElementById("newpassworderepassword");
var newpasswordgetyzm = document.getElementById("newpasswordgetyzm");
var newpasswordbtn = document.getElementById("newpasswordbtn");
var newpasswordcode = document.getElementById("newpasswordcode");

newpasswordgetyzm.onclick = function () {
    axios({
        url: '/sendEmail',
        method: 'post',
        params: {
            to: newpasswordemail.value,
        }
    })
        .then(function (data) {
            countDownTimer = setInterval(function () {
                countDownFunction();
            }, 1000);
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "获取验证码成功！";
            /*通过js设置这个按钮不可点击 */
           
            newpasswordbtn.onclick = function () {
                axios({
                    url: '/findMissPassword',
                    method: 'put',
                    params: {
                        code: newpasswordcode.value,
                        email: newpasswordemail.value,
                        password: newpasswordepassword.value,
                        rePassword: newpassworderepassword.value,

                    }
                })
                    .then(function (data) {
                        console.log("根据邮箱更改密码成功")
                        window.location.reload()
                    })
                    .catch(function (error) {
                        console.log(error)
                        console.log('根据邮箱更改密码失败')
                    })

            }
        })
        .catch(function (error) {
            console.log(error)
            console.log('失败')
        })
}




/*搜索框全局模糊查询 */

var gosearch = document.getElementById("gosearch");
var searchinput = document.getElementById("searchinput");
gosearch.onclick = function () {
    /*获取input内容 */
    var globalcontain = searchinput.value;
    if (globalcontain == "") {
        $('.prompt').show().delay(1000).fadeOut();
        prompt[0].innerText = "请输入搜索内容";
        hidesearchinput.style.display="none"
    }else{
        localStorage.setItem("globalsearchcontain", globalcontain);
        window.location.href = "/globalsearch"
    }
}



/*支付vip类型处的内容变化以及背景变化 */
var allonevipdivall = document.getElementsByClassName("allonevipdiv")
var allonevipdivone = document.getElementsByClassName("allonevipdiv")[0];
allonevipdivone.style.background = "linear-gradient(120deg,#fff7ec,#ffcb7e)"


for (let i = 0; i < allonevipdivall.length; i++) {
    allonevipdivall[i].onclick = function () {
        for (let i = 0; i < allonevipdivall.length; i++) {
            allonevipdivall[i].style.background = ""
        }
        allonevipdivall[i].style.background = "linear-gradient(120deg,#fff7ec,#ffcb7e)"
        var money = document.getElementById("money");
        if (i == "0") {
            money.innerHTML = "￥10元"
        } else if (i == "1") {
            money.innerHTML = "￥25元"
        } else if (i == "2") {
            money.innerHTML = "￥50元"
        } else if (i == "3") {
            money.innerHTML = "￥80元"
        } else if (i == "4") {
            money.innerHTML = "￥100元"
        } else if (i == "5") {
            money.innerHTML = "￥135元"
        }else{
            money.innerHTML = "￥6元"
        }
    }
}




/*积分兑换中隐藏六元大礼包 */
var viptype = document.getElementsByClassName("viptype");
for (let i = 0; i < viptype.length;i++){
    viptype[6].style.display="none"
}

/*点击历史进行查看历史！！！！ */
var historyimg = document.getElementsByClassName("historyimg");
for (let i = 0; i < historyimg.length;i++){
    var videidhistory = document.getElementsByClassName("videidhistory");
    historyimg[i].onclick = function(){
        window.location.href = '/play' + '?' + `${videidhistory[i].innerHTML}`
    }
}



/*修改视频属性的弹窗消失 */
var closechangevideo = document.getElementById("closechangevideo");

var nochangevideomessage = document.getElementById("nochangevideomessage");
closechangevideo.onclick = function () {
    hidesearchinput.style.display = "none";
    changevideocover.style.display = "none";
    changevideomodal.style.display = "none";
}
nochangevideomessage.onclick = function () {
    hidesearchinput.style.display = "none";
    /*这里也应该刷新页面 */
    changevideocover.style.display = "none";
    changevideomodal.style.display = "none";
}



var newvideomessage = document.getElementById("newvideomessage");
newvideomessage.onclick = function () {

    var changespbt = document.getElementById("changespbt")//视频标题
    var changespjj = document.getElementById("changespjj")//视频简介
    var changesptype = document.getElementById("changesptype")//视频类型
    var changesparea = document.getElementById("changesparea")//视频地区
    var changespzf = document.getElementById("changespzf");//视频资费
    var changespyear = document.getElementById("changespyear");//视频年份
    axios({
        url: '/updateVideo',
        method: 'put',
        params: {
            area: changesparea.value,
            introduction: changespjj.value,
            type: changesptype.value,
            videoId: changevideomessagevideoid.innerHTML,
            videoName: changespbt.value,
            videoTags: changesparea.value,
            whetherFree: changespzf.value,
            year: changespyear.value,
        }
    })
        .then(function (data) {
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "修改成功";
            /*来来阿里 */
            function fenyemyvideotwo(){
                containRightshangcdsjcontain.style.display = "none";
                /*点击我的视频，然后进行遍历所有我的视频！！！！！ */
                changevideomodal.style.display = "none";
                changevideocover.style.display = "none";
                containRightshangccontain.style.display = "none";
                mymp4contain.style.display = "block";
                auditcontain.style.display = "none";

                var pagenow = 1
                axios({
                    url: '/findAllVideoByUserId',
                    method: 'get',
                    params: {
                        userId: userIdmessage.innerHTML,
                        pageSize: 4,
                        pageNow: pagenow,
                    }
                })
                    .then(function (data) {
                        console.log(data.data.data.data.list[0])
                        console.log("777777777777788888888888888888888")
                        myspcontain.innerHTML = ""
                        /*共多少页 */
                        allpages.innerHTML = data.data.data.data.pageTotal
                        nowpage.innerHTML = "1"

                        for (let i = 0; i < data.data.data.data.list.length; i++) {
                            myspcontain.innerHTML += ` 
                        <div class="mysp" >
                            <input class="checkbox" type="checkbox">
                                <video style="float: left; margin-left: 5%;margin-top: 1%" width="200" height="100" controls>
                                    <source src='${data.data.data.data.list[i].videoPath}'  type="video/mp4">
                                </video>
                                <div style="height: 100%;margin-top: 0.4%;float: right;border: none;outline: none;width: 65%;">
                                    <p>
                                        视频名称：${data.data.data.data.list[i].videoName}
                                    </p>
                                    <p>
                                        <span>创建人:${data.data.data.data.list[i].nickName}</span>
                                        <span style="margin-left: 10%;">创建日期:${data.data.data.data.list[i].releaseTime}</span>
                                    </p>
                                    <p class="changevideoid" style="display: none;">
                                    ${data.data.data.data.list[i].videoId}
                                    </p>
                                    <p>
                                        <button class="showvideomessage" style="color: #00cc36;">修改信息</button>
                                        <button class = "showvideoimg" style = "color: #4e6ef2;">修改图片</button>
                                        <button class="cancelvideobtn" style="color: #ff5c38;">删除</button>
                                    </p>
                                </div>
                            </div>
                    `
                        }


                        function changevideotwo() {
                            /*修改视频属性 */
                            var showvideomessage = document.getElementsByClassName("showvideomessage");
                            var changevideocover = document.getElementById("changevideocover");
                            var changevideomodal = document.getElementById("changevideomodal");
                            var changevideoid = document.getElementsByClassName("changevideoid");
                            console.log(changevideoid)

                            for (let i = 0; i < changevideoid.length; i++) {
                                showvideomessage[i].onclick = function () {
                                    changevideocover.style.display = "block";
                                    changevideomodal.style.display = "block";
                                    var videid = changevideoid[i].innerHTML.replace(/^\s*|\s*$/g, "")
                                    console.log(videid)
                                    axios({
                                        url: "/findTVMsgByTVId",
                                        method: "get",
                                        params: {
                                            tvId: videid,
                                        }
                                    })
                                        .then(function (data) {
                                            console.log(data.data.data.data)

                                            changevideomessagevideoid.innerHTML = videid
                                            /*然后将信息遍历上去！！！！！！ */
                                            var changespbt = document.getElementById("changespbt");/*标题 */
                                            changespbt.value = data.data.data.data.videoName;
                                            var changespjj = document.getElementById("changespjj");/*简介*/
                                            changespjj.value = data.data.data.data.introduction;
                                            var changesptype = document.getElementById("changesptype");/*视频类型 */
                                            changesptype.value = data.data.data.data.videoType;
                                            var changesparea = document.getElementById("changesparea");/*视频地区 */
                                            changesparea.value = data.data.data.data.regionType;
                                            var changespzf = document.getElementById("changespzf");/*视频资费 */
                                            changespzf.value = data.data.data.data.whetherFree;
                                            var changespyear = document.getElementById("changespyear");/*视频年份*/
                                            changespyear.value = data.data.data.data.videoYear;
                                            /*视频概述！！ */
                                            var changespgs = document.getElementById("changespgs");
                                            changespgs.value = data.data.data.data.videoBriefly;

                                            /*视频封面 */
                                            console.log(data.data.data.data.videoPhoto)
                                            var videochangeimgfm = document.getElementsByClassName("videochangeimgfm")[0];
                                            videochangeimgfm.src = `${data.data.data.data.videoPhoto}`
                                            console.log(videochangeimgfm.src)
                                        })
                                        .catch(function (error) {
                                            console.log(Error)
                                        })



                                }
                            }

                            /*删除视频 */
                            var cancelvideobtn = document.getElementsByClassName("cancelvideobtn");
                            for (let i = 0; i < changevideoid.length; i++) {
                                cancelvideobtn[i].onclick = function () {
                                    var videid = changevideoid[i].innerHTML.replace(/^\s*|\s*$/g, "")
                                    axios({
                                        url: '/deleteVideo',
                                        method: 'delete',
                                        params: {
                                            videoId: videid,
                                        }
                                    })
                                        .then(function (data) {
                                            console.log(data)
                                            $('.prompt').show().delay(1000).fadeOut();
                                            prompt[0].innerText = "删除成功";
                                            myspcontain.innerHTML = ""
                                            fenyemyvideo()
                                            changevideo()
                                            // fenyemyvideo()
                                            // window.location.href = "/myperson?2"

                                        })
                                        .catch(function (error) {
                                            console.log(error)
                                            console.log('删除单个视频失败')
                                        })
                                }
                            }

                            /*修改视频图片！！！ */
                            var showvideoimg = document.getElementsByClassName("showvideoimg");
                            for (let i = 0; i < changevideoid.length; i++) {
                                showvideoimg[i].onclick = function () {
                                    changevideocover.style.display = "block";
                                    changevideoimg.style.display = "block";
                                    var videid = changevideoid[i].innerHTML.replace(/^\s*|\s*$/g, "")
                                    console.log(videid)
                                    axios({
                                        url: "/findTVMsgByTVId",
                                        method: "get",
                                        params: {
                                            tvId: videid,
                                        }
                                    })
                                        .then(function (data) {
                                            console.log(data.data.data.data)
                                            /*视频封面 */
                                            // console.log(data.data.data.data.videoPhoto)
                                            // var videochangeimgfm = document.getElementsByClassName("videochangeimgfm")[0];
                                            // videochangeimgfm.src = `${data.data.data.data.videoPhoto}`
                                            // console.log(videochangeimgfm.src)
                                        })
                                        .catch(function (error) {
                                            console.log(Error)
                                        })



                                }
                            }

                        }

                        changevideotwo()





                    })
                    .catch(function (error) {
                        console.log(error)
                    })
            }

            fenyemyvideotwo()


            // window.location.href="/myperson?2"
        })
        .catch(function (error) {
            console.log(error)
            console.log('修改视频基本信息属性失败')
        })
}

var fb = document.getElementById("fb");
var filename = document.getElementById("filename");
var file = document.getElementsByClassName("file")[0]//上传视频
var scspbt = document.getElementById("scspbt");//标题
var scspjj = document.getElementById("scspjj");//简介
var spfm = document.getElementById("spfm");//视频封面
var scsplx = document.getElementById("scsplx");//视频类型


var becomesphmodal = document.getElementById("becomesphmodal");
var ifsphuser = document.getElementById("ifsphuser");
fb.onclick = function () {
    /*首先判断是不是视频号 */
    // alert(ifsphuser.innerHTML)
    if (ifsphuser.innerHTML == "0") {
        /*不是视频号 */
        $('.prompt').show().delay(1000).fadeOut();
        prompt[0].innerText = "发布视频请先申请视频号";
        /*是视频号 */
        /*啦啦啦啦 */
        var closebecomesph = document.getElementById("closebecomesph");
        closebecomesph.onclick = function () {
            becomesphmodal.style.display = "none"
        }
        hidesearchinput.style.display = "none";

        var looksqsphrools = document.getElementById("looksqsphrools");
        looksqsphrools.onclick = function () {
            // alert("!!!!")
            /*弹出申请视频号要求！！！ */
            becomesphmodal.style.display = "block"
        }
        ifbecomevideoaccountcover.style.display = "block";
        ifbecomevideoaccountmodal.style.display = "block";

        var gosqaccount = document.getElementById("gosqaccount")//申请视频号
        gosqaccount.onclick = function () {
            /*哈哈哈 */
            axios({
                url: '/askForBecomeVideoNumber?',
                method: 'post',
                params: {
                    userId: userIdmessage.innerHTML
                }
            })
                .then(function (data) {
                    console.log(data.data.data.message)
                    if (data.data.data.message == "您的积分不足300，还不能申请成为视频号") {
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = "积分不足,申请失败";
                        ifbecomevideoaccountmodal.style.display = "none";
                        ifbecomevideoaccountcover.style.display = "none";
                    } else {
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = "申请成功";
                    }

                })
                .catch(function (error) {
                    console.log(error)
                    console.log('申请视频号失败')
                })

            hidesearchinput.style.display = "none";
        }

        var fqsqaccount = document.getElementById("fqsqaccount");//放弃申请视频号
        fqsqaccount.onclick = function () {
            hidesearchinput.style.display = "none";
            ifbecomevideoaccountcover.style.display = "none";
            ifbecomevideoaccountmodal.style.display = "none";
        }
    } else {
        /*创作中心的上传视频！！！ */
        var scspgs = document.getElementById("scspgs");
        var spcheckbox = document.getElementById("spcheckbox");
        /*将这个给文件名称！！！！ */
        // filename.value = file.files[0].name;
        /*点击发布的时候进行判断是否用户填写完毕，如果填写完毕在进行提示，如果没有填写完毕，提醒进行补充！！ */
        if (file.files[0] == undefined) {
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "尚未选择视频，请进行选择";
        } else if (scspbt.value == "") {
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "尚未填写视频标题，请进行填写";
        } else if (scspjj.value == "") {
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "尚未填写视频简介，请进行填写";
        } else if (scspgs.value == "") {
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "尚未填写视频概述，请进行填写";
        } else if (spfm.value == "") {
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "尚未选择视频封面，请进行选择";
        } else if (scsplx.value == "") {
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "尚未选择视频类型，请进行选择";
        } else 
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "上传成功";
            window.location.href = "/myperson?2"
    }
}






/*上传电视剧的接口一基本信息的传递！！ */
var fbdsj = document.getElementById("fbdsj");
fbdsj.onclick = function  (){
    var introduction = document.getElementById("introduction")
    var userid = document.getElementById("userid")

    var videoName = document.getElementById("videoName")
    var videoTyperegionType = document.getElementById("videoType.regionType")
    var videoTypevideoBriefly = document.getElementById("videoType.videoBriefly")
    var videoTypevideoTags = document.getElementById("videoType.videoTags")
    var videoTypevideoType = document.getElementById("videoType.videoType")
    var videoTypevideoYear = document.getElementById("videoType.videoYear")
    var videoTypewhetherFree = document.getElementById("videoType.whetherFree")
    var dsjgiffile = document.getElementsByClassName("dsjgiffile")[0]
    var dsjphotofile = document.getElementsByClassName("dsjphotofile")[0]
        if (ifsphuser.innerHTML == "0") {
            $('.prompt').show().delay(1000).fadeOut();
            prompt[0].innerText = "发布视频请先申请视频号";
            var closebecomesph = document.getElementById("closebecomesph");
            closebecomesph.onclick = function () {
                becomesphmodal.style.display = "none"
            }
            hidesearchinput.style.display = "none";

            var looksqsphrools = document.getElementById("looksqsphrools");
            looksqsphrools.onclick = function () {
                // alert("!!!!")
                /*弹出申请视频号要求！！！ */
                becomesphmodal.style.display = "block"
            }
            ifbecomevideoaccountcover.style.display = "block";
            ifbecomevideoaccountmodal.style.display = "block";

            var gosqaccount = document.getElementById("gosqaccount")//申请视频号
            gosqaccount.onclick = function () {
                /*哈哈哈 */
                axios({
                    url: '/askForBecomeVideoNumber?',
                    method: 'post',
                    params: {
                        userId: userIdmessage.innerHTML
                    }
                })
                    .then(function (data) {
                        console.log(data.data.data.message)
                        if (data.data.data.message == "您的积分不足300，还不能申请成为视频号") {
                            $('.prompt').show().delay(1000).fadeOut();
                            prompt[0].innerText = "积分不足,申请失败";
                            ifbecomevideoaccountmodal.style.display = "none";
                            ifbecomevideoaccountcover.style.display = "none";
                        } else {
                            $('.prompt').show().delay(1000).fadeOut();
                            prompt[0].innerText = "申请成功";
                        }

                    })
                    .catch(function (error) {
                        console.log(error)
                        console.log('申请视频号失败')
                    })

                hidesearchinput.style.display = "none";
            }

            var fqsqaccount = document.getElementById("fqsqaccount");//放弃申请视频号
            fqsqaccount.onclick = function () {
                hidesearchinput.style.display = "none";
                ifbecomevideoaccountcover.style.display = "none";
                ifbecomevideoaccountmodal.style.display = "none";
            }
        } else {
             if (videoName.value == "") {
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = "尚未填写电视剧标题，请进行填写";
            }else if (dsjgiffile.files[0] == undefined) {
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = "尚未选择电视剧悬浮动图，请进行选择";
            } else if (dsjphotofile.files[0] == undefined) {
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = "尚未选择电视剧封面，请进行选择";
            }else if (allNumber.value == "") {
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = "尚未填写视频总集数，请进行填写";
            } else if (videoTypevideoTags.value == "") {
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = "尚未填写视频标签，请进行填写";
            } else if (videoTypevideoType.value == "") {
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = "尚未选择视频类型，请进行选择";
            } else if (videoTypewhetherFree.value == "") {
                $('.prompt').show().delay(1000).fadeOut();
                prompt[0].innerText = "尚未选择视频地区，请进行选择";
            } else{



                /*来吧 */
                axios({
                    url: '/addAllTV',
                    method: 'post',
                    params: {
                        introduction: introduction.value,
                        userid: userid.value,
                        videoName: videoName.value,
                        videoTyperegionType: videoTyperegionType.value,
                        videoTypevideoBriefly: videoTypevideoBriefly.value,
                        videoTypevideoTags: videoTypevideoTags.value,
                        videoTypevideoType: videoTypevideoType.value,
                        videoTypevideoYear: videoTypevideoYear.value,
                        videoTypewhetherFree: videoTypewhetherFree.value,
                    }
                })
                    .then(function (data) {
                        console.log(data)
                        console.log(data.data.data.data)
                        var shangcdsjtwovideoid = document.getElementById("shangcdsjtwovideoid");
                        shangcdsjtwovideoid.value = data.data.data.data.videoId
                        console.log(shangcdsjtwovideoid.value)
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = data.data.data.message;
                        $('.prompt').show().delay(1000).fadeOut();
                        prompt[0].innerText = "上传成功";
                        // window.location.href = "/myperson?2"

                    })
                    .catch(function (error) {
                        console.log(error)
                        console.log('上传电视剧的接口一基本信息的传递失败')
                    })

        }

        }
}

/*修改视频的所有图片 */
var changevideallimg = document.getElementById("changevideallimg");
changevideallimg.onclick = function(){
    $('.prompt').show().delay(1000).fadeOut();
    prompt[0].innerText = "修改成功";
    changevideocover.style.display = "none";
    changevideoimg.style.display="none"
    fenyemyvideotwo()
    changevideotwo()
    // window.location.href="/myperson?2"
}

/*我的视频里关键字搜索重置 */
var clealallsearchcontain = document.getElementById("clealallsearchcontain");
clealallsearchcontain.onclick = function(){
    $('.prompt').show().delay(1000).fadeOut();
    prompt[0].innerText = "重置成功";
    fenyemyvideotwo()
    changevideotwo()
}














